Исправлен баг с валидатором ника в форме смены никнейма

This commit is contained in:
ErickSkrauch 2016-04-15 02:01:01 +03:00
parent 085869f2bc
commit a69cd2da2c
2 changed files with 18 additions and 2 deletions

View File

@ -21,7 +21,7 @@ class ChangeUsernameForm extends PasswordProtectedForm {
$account = new Account();
$account->username = $this->$attribute;
if (!$account->validate(['username'])) {
$account->addErrors($account->getErrors('username'));
$this->addErrors($account->getErrors());
}
}

View File

@ -28,7 +28,7 @@ class AccountsChangeUsernameCest {
}
public function testChangeUsername(FunctionalTester $I, Scenario $scenario) {
$I->wantTo('change my password');
$I->wantTo('change my nickname');
$I = new AccountSteps($scenario);
$I->loggedInAsActiveAccount();
@ -40,4 +40,20 @@ class AccountsChangeUsernameCest {
]);
}
public function testChangeUsernameNotAvailable(FunctionalTester $I, Scenario $scenario) {
$I->wantTo('see, that nickname "in use" is not available');
$I = new AccountSteps($scenario);
$I->loggedInAsActiveAccount();
$this->route->changeUsername('password_0', 'Jon');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
'username' => 'error.username_not_available',
],
]);
}
}