mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Мигрирована логика блокировки аккаунтов
This commit is contained in:
@ -18,7 +18,13 @@ class ActiveUserRuleTest extends TestCase {
|
||||
$account = new AccountIdentity();
|
||||
|
||||
$this->specify('get false if user not finished registration', function() use (&$account) {
|
||||
$account->status = 0;
|
||||
$account->status = Account::STATUS_REGISTERED;
|
||||
$filter = $this->getFilterMock($account);
|
||||
expect($this->callProtected($filter, 'matchCustom', new Action(null, null)))->false();
|
||||
});
|
||||
|
||||
$this->specify('get false if user has banned status', function() use (&$account) {
|
||||
$account->status = Account::STATUS_BANNED;
|
||||
$filter = $this->getFilterMock($account);
|
||||
expect($this->callProtected($filter, 'matchCustom', new Action(null, null)))->false();
|
||||
});
|
||||
|
@ -8,7 +8,6 @@ use Codeception\Specify;
|
||||
use common\models\Account;
|
||||
use tests\codeception\api\unit\DbTestCase;
|
||||
use tests\codeception\common\fixtures\AccountFixture;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* @property AccountFixture $accounts
|
||||
@ -84,6 +83,14 @@ class LoginFormTest extends DbTestCase {
|
||||
expect($model->getErrors('login'))->equals(['error.account_not_activated']);
|
||||
});
|
||||
|
||||
$this->specify('error.account_banned if account has banned status', function () {
|
||||
$model = $this->createModel([
|
||||
'account' => new AccountIdentity(['status' => Account::STATUS_BANNED]),
|
||||
]);
|
||||
$model->validateActivity('login');
|
||||
expect($model->getErrors('login'))->equals(['error.account_banned']);
|
||||
});
|
||||
|
||||
$this->specify('no errors if account active', function () {
|
||||
$model = $this->createModel([
|
||||
'account' => new AccountIdentity(['status' => Account::STATUS_ACTIVE]),
|
||||
|
Reference in New Issue
Block a user