本文整理汇总了PHP中FunctionalTester::assertTrue方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::assertTrue方法的具体用法?PHP FunctionalTester::assertTrue怎么用?PHP FunctionalTester::assertTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::assertTrue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: GetTimestamp
public function GetTimestamp(Tester $I)
{
$I->wantTo('Get Current Server Timestamp, make sure it is smaller than local');
$I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
$I->sendGET("currenttime", ["source" => $this->apiInfo[Helper::CSV_ORDER_SOURCE]]);
$response = $I->grabResponse();
$timeDifference = time() - intval($response);
$I->assertTrue($timeDifference < 90 && $timeDifference > -90);
}
示例3: it_should_allow_using_number_placeholder_when_inserting_many
/**
* @test
* it should allow using number placeholder when inserting many
*/
public function it_should_allow_using_number_placeholder_when_inserting_many(FunctionalTester $I)
{
$overrides = ['link_url' => 'http://example.com/{{n}}', 'link_name' => 'Example {{n}}', 'link_image' => 'http://example.com/images/image-{{n}}.jpg', 'link_target' => '_blank', 'link_description' => '{{n}} example link', 'link_visible' => 'N', 'link_owner' => 12, 'link_rating' => 14, 'link_updated' => Date::fromString('today'), 'link_rel' => 'nofollow', 'link_notes' => 'Not a real {{n}} image', 'link_rss' => 'http://example.com/rss/{{n}}'];
$ids = $I->haveManyLinksInDatabase(5, $overrides);
$table = $I->grabLinksTableName();
for ($i = 0; $i < count($ids); $i++) {
$I->assertTrue(is_int($ids[$i]));
foreach ($overrides as $key => $value) {
$I->seeInDatabase($table, ['link_id' => $ids[$i], $key => str_replace('{{n}}', $i, $value)]);
}
}
}
示例4: canRecordPhoto
public function canRecordPhoto(FunctionalTester $I)
{
$I->am('a developer');
$I->wantTo('ensure photos get recorded in the db');
$equipment = \BB\Entities\Equipment::findOrFail(2);
$I->assertTrue(is_array($equipment->photos), "The photos element is an array");
$I->assertEquals(0, count($equipment->photos), 'Should have no photos');
$equipment->addPhoto('foo.png');
$equipment = \BB\Entities\Equipment::findOrFail(2);
$I->assertEquals(1, count($equipment->photos), 'Should have 1 photo');
$equipment->addPhoto('bar.png');
$equipment = \BB\Entities\Equipment::findOrFail(2);
$I->assertEquals(2, count($equipment->photos), 'Should have 2 photos');
$I->assertEquals([['path' => 'foo.png'], ['path' => 'bar.png']], $equipment->photos, 'Should contain photo paths');
}
示例5: 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]);
}
示例6: filterResponse
public function filterResponse(FunctionalTester $I)
{
$port = $I->openProxy();
$I->assertNotNull($port, "`{$port}` is not a valid port");
$rep = $I->filterResponse("contents.setTextContents('<html><body>Response successfully intercepted</body></html>');");
$I->assertTrue($rep);
$I->closeProxy();
}
示例7: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a guest');
$I->wantTo('sign up for a Larabook account');
$I->amOnPage('/');
$I->click('Sign Up!');
$I->seeCurrentUrlEquals('/register');
$I->fillField('Username:', 'JohnDoe');
$I->fillField('Email:', 'john@example.com');
$I->fillField('Password:', 'demo');
$I->fillField('Password Confirmation:', 'demo');
$I->click(['class' => 'submitbutton']);
$I->seeCurrentUrlEquals('');
$I->see('Welcome to Larabook!');
$I->seeRecord('users', ['username' => 'JohnDoe', 'email' => 'john@example.com']);
$I->assertTrue(Auth::check());
示例8: it_should_allow_having_comment_meta_in_the_database
/**
* @test
* it should allow having comment meta in the database
*/
public function it_should_allow_having_comment_meta_in_the_database(FunctionalTester $I)
{
$postId = $I->havePostInDatabase();
$commentId = $I->haveCommentInDatabase($postId);
$metaId = $I->haveCommentMetaInDatabase($commentId, 'foo', 'bar');
$I->assertTrue(!empty($metaId) && is_int($metaId));
$I->seeInDatabase($I->grabCommentmetaTableName(), ['comment_id' => $commentId, 'meta_key' => 'foo', 'meta_value' => 'bar']);
}
示例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: it_should_replace_number_placeholder_when_having_many_users
/**
* @test
* it should replace number placeholder when having many users
*/
public function it_should_replace_number_placeholder_when_having_many_users(FunctionalTester $I)
{
$ids = $I->haveManyUsersInDatabase(5, 'user_{{n}}_login');
for ($i = 0; $i < 5; $i++) {
$I->assertTrue(is_int($ids[$i]));
$I->seeUserInDatabase(['ID' => $ids[$i], 'user_login' => 'user_' . $i . '_login']);
}
}
示例11: cancelOutstandingCharges
public function cancelOutstandingCharges(FunctionalTester $I)
{
$repo = app('\\BB\\Repo\\SubscriptionChargeRepository');
/** @var \BB\Repo\SubscriptionChargeRepository $repo */
$userId = 30;
$amount = rand(5, 30);
$chargeDate1 = Carbon::now()->subMonth();
$chargeDate2 = Carbon::now();
$repo->createCharge($userId, $chargeDate1, $amount, 'due');
$repo->createCharge($userId, $chargeDate2, $amount);
$I->assertTrue($repo->hasOutstandingCharges($userId), 'No outstanding charges found');
$repo->cancelOutstandingCharges($userId);
$I->assertFalse($repo->hasOutstandingCharges($userId), 'Outstanding charges found');
}
示例12: closeConnection
/**
* @env nochecking
* @depends openConnectionPassword
*/
public function closeConnection(FunctionalTester $I)
{
$I->openConnection('localhost', 32768, SecureShell::AUTH_PASSWORD, 'root', 'password');
$I->assertTrue($I->closeConnection());
}
示例13: update_my_personal_profile_with_changes
public function update_my_personal_profile_with_changes(FunctionalTester $I)
{
$I->am('Admin');
$I->wantTo('update my profile and change some informations');
$I->expectTo('see a success confirmation message and see that my data have changed');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create the admin role
$admin_role = $this->_createAdminRole();
// we attach it to the logged user
$admin_role->users()->attach($this->_user);
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->amOnPage('/');
$I->amOnRoute('users.profile');
$I->see(trans('users.page.title.profile'), 'h2');
$I->selectOption('gender', config('user.gender_key.male'));
$I->fillField('last_name', 'OTHER');
$I->fillField('first_name', 'Other');
$I->fillField('birth_date', '01/01/1999');
$I->fillField('phone_number', '0101010101');
$I->fillField('email', 'other@other.fr');
$I->fillField('address', '1 impasse Commandant Cousteau');
$I->fillField('zip_code', 99456);
$I->fillField('city', 'Toulon');
$I->fillField('country', 'Maroc');
$I->fillField('password', 'password');
$I->fillField('password_confirmation', 'password');
$I->click(trans('global.action.save'));
$I->seeCurrentRouteIs('users.profile');
$I->see(trans('global.modal.alert.title.success'), 'h3');
$I->see(trans('users.message.account.success'));
$this->_user->fresh();
$I->seeRecord('users', ['last_name' => 'OTHER', 'first_name' => 'Other', 'gender' => config('user.gender_key.male'), 'birth_date' => '1999-01-01', 'status_id' => $this->_user->status_id, 'board_id' => $this->_user->board_id, 'phone_number' => '+33 1 01 01 01 01', 'email' => 'other@other.fr', 'address' => '1 impasse Commandant Cousteau', 'zip_code' => 99456, 'city' => 'Toulon', 'country' => 'Maroc']);
$I->seeRecord('role_users', ['user_id' => $this->_user->id, 'role_id' => Sentinel::findRoleBySlug('admin')->id]);
$I->seeRecord('activations', ['user_id' => $this->_user->id, 'completed' => true]);
$user = Sentinel::getUserRepository()->findByCredentials(['email' => 'other@other.fr']);
$I->assertTrue(Hash::check('test', $user->password));
}
示例14: FunctionalTester
<?php
/* @var $scenario Codeception\Scenario */
$I = new FunctionalTester($scenario);
$I->assertTrue(Yii::$app->user->isGuest);
$I->wantTo('ensure that home page works');
$I->amOnPage('/');
$I->dontSee('Logout');
$I->see('Main');
$I->see('Login');
$I->click('Main');
$I->dontSee('Logout');
$I->see('Main');
$I->see('Login');
$user = \app\models\User::findByUsername('admin');
Yii::$app->user->login($user);
$I->assertFalse(Yii::$app->user->isGuest);
$I->amOnPage('/');
$I->see('I`m index');
$I->see('About');
$I->see('Logout');
$I->click('About');
$I->see('Information');
示例15: it_creates_default_permission_for_all_roles
public function it_creates_default_permission_for_all_roles(FunctionalTester $I)
{
$roles = Role::all();
foreach ($roles as $role) {
$rolePermissions = RolePermission::where('role_id', '=', $role->id)->with('permission')->get();
$I->assertTrue($rolePermissions->count() >= 1, 'Each role should have a default permission.');
}
}