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'); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('create a currency without data'); $I->am('a Administrator user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $I->amOnPage('/settings/currency'); //And $I->see('Create'); $I->click('Create'); //Then $I->seeCurrentUrlEquals('/settings/currency/create'); //When $form = ['name' => '', 'symbol' => '']; //And $I->submitForm('//form', $form, 'Create'); //Then $I->seeFormErrorMessage('name', 'The name field is required.'); //
<?php $I = new FunctionalTester($scenario); $I->wantTo('attempt to remind my password'); $I->haveRecord('users', ['name' => 'Joe Doe', 'email' => '*****@*****.**', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'is_confirm' => 0]); $I->amOnPage('/Password'); $I->fillField('email', '*****@*****.**'); $I->click('button[type=submit]'); $I->seeFormErrorMessage('email', 'Konto o tym adresie e-mail nie istnieje lub e-mail nie został potwierdzony');
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $I->amOnPage('/settings/users'); //And $I->click('Create'); //Then $I->seeCurrentUrlEquals('/settings/users/create'); //when $form = ['name' => 'Mario', 'email' => '*****@*****.**']; //And $I->submitForm('//form', $form, 'Save'); //Then $I->seeFormErrorMessage('password', 'The Password field is required.'); //When $form = ['name' => 'Mario', 'email' => '*****@*****.**', 'password' => '123456', 'password_confirmation' => '123456']; //and $I->submitForm('//form', $form, 'Save'); //then $I->seeCurrentUrlEquals('/settings/users'); $I->see('Mario'); $I->seeRecord('users', ['name' => 'Mario', 'email' => '*****@*****.**']);
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $I->amOnPage('/settings/users'); //And $I->click(' Create'); //Then $I->seeCurrentUrlEquals('/settings/users/create'); //when //And $I->click('Save'); $I->seeFormErrorMessage('name', 'The name field is required.'); $I->seeFormErrorMessage('email', 'The E-Mail Address field is required.'); $I->seeFormErrorMessage('password', 'The Password field is required.');
$I->fillField('password', 'pass'); $I->fillField('password_confirmation', 'pass'); $I->click('button[type=submit]'); $I->seeFormHasErrors(); $I->seeCurrentUrlEquals('/register'); $I->seeFormErrorMessages(array('email' => 'The email must be a valid email address.', 'name' => 'The name must be at least 3 characters.', 'password' => 'The password must be at least 8 characters.')); $I->dontSeeRecord('users', ['email' => 'example']); $I->expectTo('register a user with a mismatching password'); $I->fillField('name', 'Johndoe'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'passee'); $I->fillField('password_confirmation', 'pass'); $I->click('button[type=submit]'); $I->seeFormHasErrors(); $I->seeCurrentUrlEquals('/register'); $I->seeFormErrorMessage('password', 'The password confirmation does not match.'); $I->dontSeeRecord('users', ['email' => '*****@*****.**']); $I->expectTo('register a user with existing username and email'); $I->haveRecord('users', ['email' => '*****@*****.**', 'username' => 'andelabendozy', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]); $I->fillField('name', 'andelabendozy'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->fillField('password_confirmation', 'password'); $I->click('button[type=submit]'); $I->seeFormErrorMessages(array('email' => 'The email has already been taken.', 'name' => 'The name has already been taken.')); $I->expectTo('register a user with the correct details'); $I->fillField('name', 'andela'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->fillField('password_confirmation', 'password'); $I->click('button[type=submit]');
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $I->amOnPage('/settings/users'); //And $I->click('Create'); //Then $I->seeCurrentUrlEquals('/settings/users/create'); //When $form = ['name' => 'Mario', 'email' => '*****@*****.**', 'password' => '123456', 'password_confirmation' => '123456']; //and $I->submitForm('//form', $form, 'Save'); //then $I->seeFormErrorMessage('email', 'The E-Mail Address has already been taken.');
<?php $I = new FunctionalTester($scenario); $I->wantTo('test form error assertions'); $I->amOnPage('/'); $I->click('Utwórz konto', '.btn-register'); $I->seeCurrentUrlEquals('/Register'); $I->click('button[type=submit]'); $I->seeFormHasErrors(); $I->seeFormErrorMessages(array('name' => 'Pole nazwa użytkownika jest wymagane.', 'email' => 'Pole email jest wymagane.', 'password' => 'Pole hasło jest wymagane.')); $I->fillField('name', '^%&%%$^$'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->fillField('password_confirmation', 'password'); $I->click('button[type=submit]'); $I->seeFormErrorMessage('name', 'Nazwa użytkownika może zawierać litery, cyfry oraz znaki ._ -');
<?php $I = new FunctionalTester($scenario); $I->wantTo('login as a user'); $I->haveRecord('users', ['email' => '*****@*****.**', 'username' => 'johndoe', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]); $I->amOnPage('/login'); $I->fillField('email', 'john@doe.c'); $I->fillField('password', 'password'); $I->click('button[type=submit]'); $I->seeFormHasErrors(); $I->seeFormErrorMessage(null, 'These credentials do not match our records.'); $I->dontSeeAuthentication(); $I->amOnPage('/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->click('button[type=submit]'); $I->amOnPage('/'); $I->seeAuthentication(); $I->logout();