mirror of
https://github.com/elyby/accounts.git
synced 2024-12-27 15:40:21 +05:30
Дописаны недостающие тесты для форм смены E-mail адреса
This commit is contained in:
parent
f99b281f30
commit
6c74e23157
@ -35,4 +35,19 @@ class AccountsRoute extends BasePage {
|
||||
$this->actor->sendPOST($this->getUrl());
|
||||
}
|
||||
|
||||
public function changeEmailSubmitNewEmail($key = null, $email = null) {
|
||||
$this->route = ['accounts/change-email-submit-new-email'];
|
||||
$this->actor->sendPOST($this->getUrl(), [
|
||||
'key' => $key,
|
||||
'email' => $email,
|
||||
]);
|
||||
}
|
||||
|
||||
public function changeEmailConfirmNewEmail($key = null) {
|
||||
$this->route = ['accounts/change-email-confirm-new-email'];
|
||||
$this->actor->sendPOST($this->getUrl(), [
|
||||
'key' => $key,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\functional;
|
||||
|
||||
use Codeception\Specify;
|
||||
use tests\codeception\api\_pages\AccountsRoute;
|
||||
use tests\codeception\api\FunctionalTester;
|
||||
|
||||
class AccountsChangeEmailConfirmNewEmailCest {
|
||||
|
||||
/**
|
||||
* @var AccountsRoute
|
||||
*/
|
||||
private $route;
|
||||
|
||||
public function _before(FunctionalTester $I) {
|
||||
$this->route = new AccountsRoute($I);
|
||||
}
|
||||
|
||||
public function testConfirmNewEmail(FunctionalTester $I) {
|
||||
$I->wantTo('change my email and get changed value');
|
||||
$I->loggedInAsActiveAccount('CrafterGameplays', 'password_0');
|
||||
|
||||
$this->route->changeEmailConfirmNewEmail('H28HBDCHHAG2HGHGHS');
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseIsJson();
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'email' => 'my-new-email@ely.by',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\functional;
|
||||
|
||||
use Codeception\Specify;
|
||||
use tests\codeception\api\_pages\AccountsRoute;
|
||||
use tests\codeception\api\FunctionalTester;
|
||||
|
||||
class AccountsChangeEmailSubmitNewEmailCest {
|
||||
|
||||
/**
|
||||
* @var AccountsRoute
|
||||
*/
|
||||
private $route;
|
||||
|
||||
public function _before(FunctionalTester $I) {
|
||||
$this->route = new AccountsRoute($I);
|
||||
}
|
||||
|
||||
public function testSubmitNewEmail(FunctionalTester $I) {
|
||||
$I->wantTo('submit new email');
|
||||
$I->loggedInAsActiveAccount('ILLIMUNATI', 'password_0');
|
||||
|
||||
$this->route->changeEmailSubmitNewEmail('H27HBDCHHAG2HGHGHS', 'my-new-email@ely.by');
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseIsJson();
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
@ -75,8 +75,20 @@ return [
|
||||
'created_at' => 1462891612,
|
||||
'updated_at' => 1462891612,
|
||||
],
|
||||
'account-with-change-email-finish-state' => [
|
||||
'account-with-change-email-init-state' => [
|
||||
'id' => 7,
|
||||
'uuid' => '7d728533-847a-4661-9bc7-3df01b2282ef',
|
||||
'username' => 'ILLIMUNATI',
|
||||
'email' => 'illuminati@gmail.com',
|
||||
'password_hash' => '$2y$13$2rYkap5T6jG8z/mMK8a3Ou6aZxJcmAaTha6FEuujvHEmybSHRzW5e', # password_0
|
||||
'password_hash_strategy' => \common\models\Account::PASS_HASH_STRATEGY_YII2,
|
||||
'lang' => 'en',
|
||||
'status' => \common\models\Account::STATUS_ACTIVE,
|
||||
'created_at' => 1463427287,
|
||||
'updated_at' => 1463427287,
|
||||
],
|
||||
'account-with-change-email-finish-state' => [
|
||||
'id' => 8,
|
||||
'uuid' => '4c34f2cc-4bd9-454b-9583-bb52f020ec16',
|
||||
'username' => 'CrafterGameplays',
|
||||
'email' => 'crafter@gmail.com',
|
||||
|
@ -30,9 +30,15 @@ return [
|
||||
'type' => \common\models\EmailActivation::TYPE_CURRENT_EMAIL_CONFIRMATION,
|
||||
'created_at' => time() - 10,
|
||||
],
|
||||
'newEmailConfirmation' => [
|
||||
'currentChangeEmailConfirmation' => [
|
||||
'key' => 'H27HBDCHHAG2HGHGHS',
|
||||
'account_id' => 7,
|
||||
'type' => \common\models\EmailActivation::TYPE_CURRENT_EMAIL_CONFIRMATION,
|
||||
'created_at' => time() - 10,
|
||||
],
|
||||
'newEmailConfirmation' => [
|
||||
'key' => 'H28HBDCHHAG2HGHGHS',
|
||||
'account_id' => 8,
|
||||
'type' => \common\models\EmailActivation::TYPE_NEW_EMAIL_CONFIRMATION,
|
||||
'_data' => serialize(['newEmail' => 'my-new-email@ely.by']),
|
||||
'created_at' => time() - 10,
|
||||
|
Loading…
Reference in New Issue
Block a user