Esempio n. 1
0
 /**
  * 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]);
 }
Esempio 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');