本文整理汇总了PHP中FunctionalTester::assertEquals方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::assertEquals方法的具体用法?PHP FunctionalTester::assertEquals怎么用?PHP FunctionalTester::assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::assertEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_should_alter_the_user_table
/**
* @test
* it should alter the users table
*/
public function it_should_alter_the_user_table(FunctionalTester $I)
{
$first = $I->haveMultisiteInDatabase();
$second = $I->haveMultisiteInDatabase();
foreach ($second as $table => $output) {
$I->assertEquals('alter', $output['operation']);
$I->assertEquals($table == 'users', $output['exit']);
}
}
示例2: returnExistingCharges
public function returnExistingCharges(FunctionalTester $I)
{
$repo = app('\\BB\\Repo\\SubscriptionChargeRepository');
/** @var \BB\Repo\SubscriptionChargeRepository $repo */
$userId = 23;
$amount = rand(5, 30);
$chargeDate1 = Carbon::now()->subMonth();
$chargeDate2 = Carbon::now();
$repo->createCharge($userId, $chargeDate1, $amount);
$repo->createCharge($userId, $chargeDate2, $amount);
$charges = $repo->getMemberCharges($userId);
$I->assertEquals(2, $charges->count());
$I->assertEquals($amount, $charges->first()->amount);
$I->assertEquals($chargeDate2->setTime(0, 0, 0), $charges->first()->charge_date);
}
示例3: ResponseOfInvalidSource
public function ResponseOfInvalidSource(Tester $I)
{
$I->wantToTest('response if we provide an Invalid Source');
$I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
$I->sendGET("currenttime", ["source" => 'airfares']);
//Not matching the API Key
$I->assertEquals(json_decode('{"code": "2","message":"Invalid source."}'), json_decode($I->grabResponse()));
}
示例4: it_should_allow_inserting_many_posts_and_return_an_array_of_ids
/**
* @test
* it should allow inserting many posts and return an array of ids
*/
public function it_should_allow_inserting_many_posts_and_return_an_array_of_ids(FunctionalTester $I)
{
$ids = $I->haveManyPostsInDatabase(5);
$I->assertEquals(5, count(array_unique($ids)));
array_map(function ($id) use($I) {
$I->assertTrue(is_int($id));
}, $ids);
}
示例5: testSubChargeFetching
/**
* Confirm sub charge records can be created and fetched
*
* @param FunctionalTester $I
*/
public function testSubChargeFetching(FunctionalTester $I)
{
$subChargeRepo = App::make('\\BB\\Repo\\SubscriptionChargeRepository');
$subChargeRepo->createCharge(10, Carbon::now());
$charge = $subChargeRepo->findCharge(10);
$I->assertNotNull($charge);
$I->assertEquals(10, $charge->user_id);
}
示例6: it_should_allow_getting_non_blog_id_prefixed_table_names_for_main_blog
/**
* @test
* it should allow getting non blog id prefixed table names for main blog
*/
public function it_should_allow_getting_non_blog_id_prefixed_table_names_for_main_blog(FunctionalTester $I)
{
$tables = ['commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'term_relationships', 'term_taxonomy', 'terms', 'termmeta'];
foreach ($tables as $table) {
$I->useMainBlog();
$tableName = $I->grabPrefixedTableNameFor($table);
$I->assertEquals($I->grabTablePrefix() . $table, $tableName);
}
}
示例7: it_should_allow_having_many_comments_with_number_placeholder
/**
* @test
* it should allow having many comments with number placeholder
*/
public function it_should_allow_having_many_comments_with_number_placeholder(FunctionalTester $I)
{
$postId = $I->havePostInDatabase();
$overrides = ['comment_author' => 'Luca', 'comment_author_email' => 'luca@example.com', 'comment_author_url' => 'https://theaveragedev.com', 'comment_author_IP' => '111.222.333.444', 'comment_date' => Date::now(), 'comment_date_gmt' => Date::gmtNow(), 'comment_content' => "No comment", 'comment_karma' => '3', 'comment_approved' => '0', 'comment_agent' => 'some agent', 'comment_type' => 'status', 'comment_parent' => 23, 'user_id' => 12];
$ids = $I->haveManyCommentsInDatabase(5, $postId, $overrides);
$I->assertEquals(5, count($ids));
for ($i = 0; $i < count($ids); $i++) {
foreach ($overrides as $key => $value) {
$I->seeInDatabase($I->grabCommentsTableName(), ['comment_post_ID' => $postId, 'comment_ID' => $ids[$i], $key => str_replace('{{n}}', $i, $value)]);
}
}
}
示例8: testTheMinimumPasswordLength
/**
* Checks that the minimum password requirement is working as expected (IS-21).
*
* @param FunctionalTester $I
*/
public function testTheMinimumPasswordLength(FunctionalTester $I)
{
// assert that the property exists
$I->assertTrue(isset(Yii::$app->user->minPasswordLength));
// assert that the default value of the property is 6
$I->assertEquals(6, Yii::$app->user->minPasswordLength);
// try to register a user with a shorter password
$registerPage = RegisterPage::openBy($I);
$registerPage->register(Commons::TEST_EMAIL, '12345');
// it must fail
$I->see('Password should contain at least 6 characters.');
$I->dontSeeRecord(User::className(), ['email' => Commons::TEST_EMAIL]);
// try to register a user with a correct password length
$registerPage->register(Commons::TEST_EMAIL, 'Innologica!23');
// it must pass
$I->seeRecord(User::className(), ['email' => Commons::TEST_EMAIL]);
}
示例9: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->nodes()->columns(['exchange_types.name']);
$count = count($items);
$I->assertTrue($count > 0);
$expected = [['name' => 'direct'], ['name' => 'headers'], ['name' => 'topic'], ['name' => 'fanout']];
$I->assertEquals($expected, $items[0]['exchange_types']);
示例10: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->extensions();
$count = count($items);
$I->assertTrue($count > 0);
$expected = ['javascript' => 'dispatcher.js'];
$I->assertEquals($expected, $items[0]);
示例11: it_should_allow_grabbing_a_site_transient_while_using_secondary_blog
/**
* @test
* it should allow grabbing a site transient while using secondary blog
*/
public function it_should_allow_grabbing_a_site_transient_while_using_secondary_blog(FunctionalTester $I)
{
$table = $I->grabPrefixedTableNameFor('options');
$I->haveInDatabase($table, ['option_name' => '_site_transient_key', 'option_value' => 'foo']);
$I->useBlog(2);
$value = $I->grabSiteTransientFromDatabase('key');
$I->assertEquals('foo', $value);
}
示例12: testGetConceptPropertiesArray
public function testGetConceptPropertiesArray(FunctionalTester $I)
{
$concept = ConceptPeer::retrieveByPK(727);
$propertyArray = jsonldService::getConceptPropertyArray($concept);
$I->assertEquals(json_encode($propertyArray,
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), '{
"@id": "http://rdaregistry.info/termList/AspectRatio/1001",
"@type": "Concept",
"api": "http://api.metadataregistry.org/concepts/727",
"inScheme": "http://rdaregistry.info/termList/AspectRatio/",
"status": "Published",
"prefLabel": {
"en": "full screen",
"de": "Vollbild",
"fr": "plein écran",
"es": "pantalla completa",
"zh": "全屏"
},
"scopeNote": {
"en": "Use for standard format, i.e., 1.33:1 or 4:3."
},
"definition": {
"en": "Aspect ratio for a moving image resource of less than 1.5:1.",
"de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.",
"fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.",
"es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.",
"zh": "动态图像资源的宽高比小于1.5:1。"
},
"ToolkitLabel": {
"en": "full screen",
"fr": "plein écran",
"de": "Vollbild",
"es": "pantalla completa",
"zh": "全屏"
},
"ToolkitDefinition": {
"en": "Aspect ratio for a moving image resource of less than 1.5:1.",
"fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.",
"de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.",
"es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.",
"zh": "动态图像资源的宽高比小于1.5:1。"
},
"altLabel": {
"en": [
"full-screen",
"full-screen",
"fullscreen",
"full-screen"
]
}
}');
}
示例13: it_should_allow_grabbing_a_user_unique_meta
/**
* @test
* it should allow grabbing a user unique meta
*/
public function it_should_allow_grabbing_a_user_unique_meta(FunctionalTester $I)
{
$I->haveUserInDatabase('Luca');
$userId = $I->grabUserIdFromDatabase('Luca');
$I->haveUserMetaInDatabase($userId, 'some_key', 'some_value');
$meta = $I->grabUserMetaFromDatabase($userId, 'some_key');
$I->assertEquals(1, count($meta));
$I->assertEquals('some_value', $meta[0]);
}
示例14: FunctionalTester
<?php
$fixture = (require 'fixtures/definition.php');
$I = new FunctionalTester($scenario);
$rabman = new \Rabman\ResourceFactory(\Codeception\Util\Fixtures::get('rabman-opt'));
$items = $rabman->definitions();
$count = count($items);
$I->assertTrue($count > 0);
$rabman->definitions()->vhost()->create(json_decode($fixture, true));
$items = $rabman->exchanges('second.exchange.5')->columns(['name']);
count($items);
$I->assertTrue($count > 0);
$I->assertEquals('second.exchange.5', $items[0]['name']);
示例15: redirectUrl
public function redirectUrl(FunctionalTester $I)
{
$port = $I->openProxy();
$I->assertNotNull($port, "`{$port}` is not a valid port");
$rep = $I->redirectUrl('http://testdomain.url/', 'http://codeception.com/');
$I->assertTrue($rep);
$I->startHar('codeception');
Requests::get('http://testdomain.url/', [], ['proxy' => "127.0.0.1:{$port}"]);
$har = $I->getHar();
$I->assertEquals('http://codeception.com/', $har['log']['entries'][0]['request']['url']);
$I->closeProxy();
}