Ejemplo n.º 1
0
 public function testPasswordRecoveryRequest(FunctionalTester $I)
 {
     // Create one user
     $user = Commons::createUser();
     $I->expectTo('see the recovery form when going to the recovery page');
     $passwordRecoveryRequestPage = PasswordRecoveryRequestPage::openBy($I);
     $I->seeElement('#password-recovery-form');
     $I->expectTo('see that a proper message is sent when an empty email is set');
     $passwordRecoveryRequestPage->submitRecoveryForm('');
     $I->seeElement('#password-recovery-form');
     $I->see('Email cannot be blank');
     $I->expectTo('see that a proper message is sent when a wrong email is set');
     $passwordRecoveryRequestPage->submitRecoveryForm('test@fds');
     $I->seeElement('#password-recovery-form');
     $I->see('Email is not a valid email address.');
     $I->expectTo('see that a proper message is sent when an email of unexisting user is set');
     $passwordRecoveryRequestPage->submitRecoveryForm('*****@*****.**');
     $I->seeElement('#password-recovery-form');
     $I->see('There is no user with this email address');
     $I->amGoingTo('save the form with correct data');
     $passwordRecoveryRequestPage->submitRecoveryForm(Commons::TEST_EMAIL);
     $I->expectTo('see the user is redirected to the correct page');
     $I->see('Recovery message sent');
     $I->expectTo('see that a the token is saved to the database');
     $I->seeRecord(Token::className(), ['user_id' => $user->id]);
     $I->expectTo('see that a recovery email is sent to the user');
     $I->assertNotEmpty($this->mailDir);
 }
Ejemplo n.º 2
0
<?php

use nkostadinov\user\tests\_pages\ChangePasswordPage;
use nkostadinov\user\tests\_pages\LoginPage;
use nkostadinov\user\tests\_pages\PasswordRecoveryRequestPage;
use nkostadinov\user\tests\_pages\RegisterPage;
$I = new FunctionalTester($scenario);
$I->wantTo('test whether all view files are found by the controller actions');
// Login page test
$loginPage = LoginPage::openBy($I);
$I->seeInTitle('Login');
$I->seeElement('#login-form');
// Register page test
RegisterPage::openBy($I);
$I->seeInTitle('Signup');
// Change password page
ChangePasswordPage::openBy($I);
$I->seeInTitle('Change password');
$I->seeElement('#change-password-form');
// Password recovery page
PasswordRecoveryRequestPage::openBy($I);
$I->seeInTitle('Recover your password');
$I->seeElement('#password-recovery-form');