本文整理汇总了PHP中FunctionalTester::haveRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::haveRecord方法的具体用法?PHP FunctionalTester::haveRecord怎么用?PHP FunctionalTester::haveRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::haveRecord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDuplicateEmail
public function testDuplicateEmail(FunctionalTester $I)
{
$I->haveRecord('users', ['email' => $this->tester['email']]);
$I->fillField('email', $this->tester['email']);
$I->click('Register', 'button');
$I->seeFormErrorMessage('email', 'already been taken');
}
示例2: canEditMicroblog
public function canEditMicroblog(FunctionalTester $I)
{
$fake = Factory::create();
$text = $fake->text();
$id = $I->haveRecord('microblogs', ['user_id' => $this->user->id, 'text' => $text, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'score' => 0]);
$I->amOnRoute('microblog.save', [$id]);
$I->see($text);
}
示例3: deleteMyRedirect
public function deleteMyRedirect(FunctionalTester $I)
{
$I->haveRecord('links', $this->linkRecord);
LinksPage::of($I)->deleteLink();
$I->dontSeeRecord('links', $this->linkRecord);
$I->seeCurrentUrlEquals(LinksPage::$URL);
$I->dontSee('/' . $this->link['uri']);
}
示例4: deletePost
public function deletePost(FunctionalTester $I)
{
$id = $I->haveRecord('posts', $this->postAttributes);
$I->amOnPage(PostsPage::$url);
$I->see('Hello Universe');
PostsPage::of($I)->deletePost($id);
$I->seeCurrentUrlEquals(PostsPage::$url);
$I->dontSee('Hello Universe');
}
示例5: testLoginSuccsess
public function testLoginSuccsess(FunctionalTester $I)
{
$I->wantTo('login as a user');
$I->haveRecord('users', ['name' => 'john', 'email' => 'john@gmail.com', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->amOnPage('auth/login');
$I->fillField('email', 'john@gmail.com');
$I->fillField('password', '123456');
$I->click('Login');
$I->amOnPage('/');
$I->seeAuthentication();
}
示例6: loginUsingCredentials
public function loginUsingCredentials(FunctionalTester $I)
{
$I->dontSeeAuthentication();
$I->haveRecord('users', $this->userAttributes);
$I->amLoggedAs(['email' => 'john@doe.com', 'password' => 'password']);
$I->amOnPage(PostsPage::$url);
$I->seeCurrentUrlEquals(PostsPage::$url);
$I->seeAuthentication();
$I->logout();
$I->dontSeeAuthentication();
}
示例7: tryRegisterDesiredInputWithDefaultRole
public function tryRegisterDesiredInputWithDefaultRole(FunctionalTester $I)
{
$I->haveRecord('roles', ['id' => 2, 'name' => 'Spectator', 'slug' => 'spectator', 'landing' => 'admin/profile', 'is_default' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->wantTo('Register a user with desired input');
$I->amOnPage('/register');
$I->fillField('username', 'usertest');
$I->fillField('email', 'usertest@email.com');
$I->fillField('password', '123456');
$I->fillField('password_confirmation', '123456');
$I->click('button[type=submit]');
$I->seeRecord('users', ['username' => 'usertest']);
$I->seeCurrentUrlEquals('/login');
}
示例8: _before
public function _before(FunctionalTester $I)
{
$dt = new DateTime();
$I->haveRecord('roles', ['id' => 1, 'name' => 'Administrator', 'slug' => 'administrator', 'landing' => 'admin/dashboard', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('users', ['id' => 1, 'username' => 'admin', 'email' => 'admin@site.com', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('users', ['id' => 2, 'username' => 'admin2', 'email' => 'admin2@site.com', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('password_resets', ['email' => 'admin@site.com', 'token' => 'reset-token', 'created_at' => new DateTime()]);
$I->haveRecord('password_resets', ['email' => 'admin2@site.com', 'token' => 'reset-token2', 'created_at' => $dt->modify('-2 hour')]);
$I->haveRecord('role_user', ['user_id' => 1, 'role_id' => 1]);
$I->haveRecord('role_user', ['user_id' => 2, 'role_id' => 1]);
}
示例9: _before
public function _before(FunctionalTester $I)
{
$I->haveRecord('roles', ['id' => 1, 'name' => 'Administrator', 'slug' => 'administrator', 'landing' => 'admin/dashboard', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('roles', ['id' => 2, 'name' => 'Spectator', 'slug' => 'spectator', 'landing' => 'admin/profile', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('users', ['id' => 1, 'username' => 'admin', 'email' => 'admin@site.com', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('users', ['id' => 2, 'username' => 'spectator', 'email' => 'spectator@site.com', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->haveRecord('role_user', ['user_id' => 1, 'role_id' => 1]);
$I->haveRecord('role_user', ['user_id' => 2, 'role_id' => 2]);
}
示例10:
$I->see('Username', 'label');
$I->see('Password', 'label');
$I->see('Remember me', 'label');
$I->seeElement('input', ['value' => 'Log in', 'class' => 'btn btn-primary btn-block']);
$I->amGoingTo('fill an invalid user in order to see the errors');
// When
$I->fillField('username', 'admin');
$I->fillField('password', '12345');
// And
$I->click('Log in', 'input[type=submit]');
// Then
$I->expectTo('see an error message');
$I->seeCurrentUrlEquals('/login');
$I->seeInField('username', 'admin');
$I->see('Invalid data', '.alert-danger');
$I->haveRecord('users', ['first_name' => 'System', 'last_name' => 'Administrator', 'username' => 'admin', 'password' => Hash::make('secret'), 'email' => 'dacosta.dev@nucleogps.com', 'remember_token' => null]);
$I->amGoingTo('full a valid user and see the result');
// When
$I->fillField('password', 'secret');
// And
$I->click('Log in', 'input[type=submit]');
// Then
$I->seeCurrentUrlEquals('');
$I->see('You have arrived.', 'h1');
$I->see('Log out', 'a');
$I->seeAuthentication();
$I->amGoingTo('log out');
// When
$I->click('Log out', 'a');
// Then
$I->seeCurrentUrlEquals('/login');
示例11: FunctionalTester
<?php
use Coyote\Actkey;
$I = new FunctionalTester($scenario);
$I->wantTo('confirm my email address');
$userId = 100001;
$actkey = 'randomstring';
$I->haveRecord('users', ['id' => $userId, 'name' => 'Joe Doe', 'email' => 'joe@doe.com', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'is_confirm' => 0]);
// uzywamy modelu poniewaz w tabeli nie ma klucza "id"
Actkey::create(['actkey' => $actkey, 'user_id' => $userId]);
$I->amOnPage("/User/Confirm/Email?id={$userId}&actkey={$actkey}");
$I->see('Adres e-mail został pozytywnie potwierdzony');
$I->dontSeeRecord('actkeys', ['actkey' => $actkey, 'user_id' => $userId]);
示例12: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a Administrator see Partners');
$I->dontSeeAuthentication();
$I->amLoggedAs(['email' => 'admin@admin.com', 'password' => 'admin']);
$I->seeAuthentication();
$id = $I->haveRecord('partners', ['name' => 'Mario', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1]);
$I->amOnPage('/partners/' . $id);
$I->see('Mario');
示例13: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('I am Admin and Update Company Mau');
$I->dontSeeAuthentication();
$I->amLoggedAs(['email' => 'admin@admin.com', 'password' => 'admin']);
$I->seeAuthentication();
//When
$id = $I->haveRecord('companys', ['name' => 'Maur', 'partner_id' => '2', 'currency_id' => '3', 'fiscalRegimen_id' => '2']);
//And
$I->amOnPage('/settings/company/' . $id);
//then
$I->see('Edit');
//When
$I->click('Edit');
$I->seeCurrentUrlEquals('/settings/company/' . $id . '/edit');
$I->seeInField('name', 'Maur');
$I->seeInField('partner_id', '2');
$I->seeInField('currency_id', '3');
$I->seeInField('fiscalRegimen_id', '2');
//And
$I->amGoingTo('Change name of Maur to Association_Mau');
$form = ['name' => 'Association_Mau', 'partner_id' => '3', 'currency_id' => '2', 'fiscalRegimen_id' => '1'];
示例14: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->expectTo('have a usere in the database');
$I->haveRecord('users', ['username' => 'verem', 'password' => 'danverem', 'email' => 'danverem@gmail.com', 'profile_state' => 0]);
$I->expectTo('have a logged in user');
$user = $I->grabRecord('users', ['username' => 'verem']);
$I->amLoggedAs(['username' => $user->username, 'id' => $user->id, 'password' => $user->password]);
$I->wantTo('test if chops is posting to database');
$I->amOnAction('ChopsController@create');
$I->seeInCurrentUrl('/create');
$I->see('What\'s that special meal you just ate today');
$I->fillField('name', 'edikaikong');
$I->attachFile('image', 'julia.jpeg');
$I->fillField('about', 'This food is the best dish in the country');
$I->click('submitButton');
$I->seeInCurrentUrl('/chops');
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('login as a user');
$I->haveRecord('users', ['name' => 'Joe Doe', 'email' => 'joe@doe.com', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->amOnPage('/Login');
$I->fillField('name', 'Joe Doe');
$I->fillField('password', '123');
$I->click('button[type=submit]');
$I->amOnPage('/');
$I->seeAuthentication();
$I->see('Joe Doe', '.dropdown-username');