2016-05-11 01:55:04 +05:30
|
|
|
<?php
|
|
|
|
namespace codeception\api\functional;
|
|
|
|
|
|
|
|
use tests\codeception\api\_pages\AuthenticationRoute;
|
|
|
|
use tests\codeception\api\FunctionalTester;
|
|
|
|
|
|
|
|
class ForgotPasswordCest {
|
|
|
|
|
|
|
|
public function testForgotPasswordByEmail(FunctionalTester $I) {
|
|
|
|
$route = new AuthenticationRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('create new password recover request by passing email');
|
|
|
|
$route->forgotPassword('admin@ely.by');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testForgotPasswordByUsername(FunctionalTester $I) {
|
|
|
|
$route = new AuthenticationRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('create new password recover request by passing username');
|
|
|
|
$route->forgotPassword('Admin');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.emailMask');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testDataForFrequencyError(FunctionalTester $I) {
|
|
|
|
$route = new AuthenticationRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('get info about time to repeat recover password request');
|
|
|
|
$route->forgotPassword('Notch');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
2016-06-17 01:06:52 +05:30
|
|
|
'login' => 'error.recently_sent_message',
|
2016-05-11 01:55:04 +05:30
|
|
|
],
|
|
|
|
]);
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|