mirror of
https://github.com/elyby/accounts.git
synced 2025-05-04 08:33:49 +05:30
Исправлен баг с валидатором ника в форме смены никнейма
This commit is contained in:
parent
085869f2bc
commit
a69cd2da2c
@ -21,7 +21,7 @@ class ChangeUsernameForm extends PasswordProtectedForm {
|
|||||||
$account = new Account();
|
$account = new Account();
|
||||||
$account->username = $this->$attribute;
|
$account->username = $this->$attribute;
|
||||||
if (!$account->validate(['username'])) {
|
if (!$account->validate(['username'])) {
|
||||||
$account->addErrors($account->getErrors('username'));
|
$this->addErrors($account->getErrors());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class AccountsChangeUsernameCest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testChangeUsername(FunctionalTester $I, Scenario $scenario) {
|
public function testChangeUsername(FunctionalTester $I, Scenario $scenario) {
|
||||||
$I->wantTo('change my password');
|
$I->wantTo('change my nickname');
|
||||||
$I = new AccountSteps($scenario);
|
$I = new AccountSteps($scenario);
|
||||||
$I->loggedInAsActiveAccount();
|
$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',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user