mirror of
https://github.com/elyby/accounts.git
synced 2026-04-26 01:02:55 +05:30
При попытке запроса смены E-mail теперь происходит проверка, как давно был выполнен предыдущий запрос
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\functional;
|
||||
|
||||
use Codeception\Specify;
|
||||
use tests\codeception\api\_pages\AccountsRoute;
|
||||
use tests\codeception\api\FunctionalTester;
|
||||
|
||||
@@ -28,4 +27,19 @@ class AccountsChangeEmailInitializeCest {
|
||||
]);
|
||||
}
|
||||
|
||||
public function testChangeEmailInitializeFrequencyError(FunctionalTester $I) {
|
||||
$I->wantTo('see change email request frequency error');
|
||||
$I->loggedInAsActiveAccount('ILLIMUNATI', 'password_0');
|
||||
|
||||
$this->route->changeEmailInitialize('password_0');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'email' => 'error.recently_sent_message',
|
||||
],
|
||||
]);
|
||||
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
||||
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,14 +62,15 @@ class NewEmailFormTest extends DbTestCase {
|
||||
public function testSendNewEmailConfirmation() {
|
||||
$this->specify('send email', function() {
|
||||
/** @var Account $account */
|
||||
$account = Account::findOne($this->accounts['admin']['id']);
|
||||
$account = Account::findOne($this->accounts['account-with-change-email-init-state']['id']);
|
||||
/** @var NewEmailForm $model */
|
||||
$key = $this->emailActivations['currentChangeEmailConfirmation']['key'];
|
||||
$model = new NewEmailForm($account, [
|
||||
'key' => $this->emailActivations['currentEmailConfirmation']['key'],
|
||||
'key' => $key,
|
||||
'email' => 'my-new-email@ely.by',
|
||||
]);
|
||||
expect($model->sendNewEmailConfirmation())->true();
|
||||
expect(EmailActivation::findOne($this->emailActivations['currentEmailConfirmation']['key']))->null();
|
||||
expect(EmailActivation::findOne($key))->null();
|
||||
expect(EmailActivation::findOne([
|
||||
'account_id' => $account->id,
|
||||
'type' => EmailActivation::TYPE_NEW_EMAIL_CONFIRMATION,
|
||||
|
||||
Reference in New Issue
Block a user