Реализована форма смены ника пользователя

Добавлена базовая форма с запросом пароля
Валидация ника и email адреса вынесены из формы регистрации в модель аккаунта
Отрефакторен тест формы регистрации
Добавлены тесты для модели аккаунта
This commit is contained in:
ErickSkrauch
2016-03-20 02:25:26 +03:00
parent 8b1c3a477a
commit e67257b8aa
12 changed files with 431 additions and 55 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace tests\codeception\api\functional;
use Codeception\Scenario;
use Codeception\Specify;
use common\models\Account;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\_pages\LoginRoute;
use tests\codeception\api\functional\_steps\AccountSteps;
use tests\codeception\api\FunctionalTester;
class AccountsChangeUsernameCest {
/**
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new AccountsRoute($I);
}
public function _after(FunctionalTester $I) {
/** @var Account $account */
$account = Account::findOne(1);
$account->username = 'Admin';
$account->save();
}
public function testChangeUsername(FunctionalTester $I, Scenario $scenario) {
$I->wantTo('change my password');
$I = new AccountSteps($scenario);
$I->loggedInAsActiveAccount();
$this->route->changeUsername('password_0', 'bruce_wayne');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'success' => true,
]);
}
}