mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Update ely/php-code-style and run updated CS fixer
This commit is contained in:
@@ -27,8 +27,8 @@ class JwtIdentityTest extends TestCase {
|
||||
$token = $this->generateToken();
|
||||
$identity = JwtIdentity::findIdentityByAccessToken($token);
|
||||
$this->assertInstanceOf(IdentityInterface::class, $identity);
|
||||
$this->assertEquals($token, $identity->getId());
|
||||
$this->assertEquals($this->tester->grabFixture('accounts', 'admin')['id'], $identity->getAccount()->id);
|
||||
$this->assertSame($token, $identity->getId());
|
||||
$this->assertSame($this->tester->grabFixture('accounts', 'admin')['id'], $identity->getAccount()->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,7 +27,7 @@ class ConfirmEmailFormTest extends TestCase {
|
||||
$this->assertFalse($activationExists, 'email activation key is not exist');
|
||||
/** @var Account $account */
|
||||
$account = Account::findOne($fixture['account_id']);
|
||||
$this->assertEquals(Account::STATUS_ACTIVE, $account->status, 'user status changed to active');
|
||||
$this->assertSame(Account::STATUS_ACTIVE, $account->status, 'user status changed to active');
|
||||
}
|
||||
|
||||
private function createModel($key) {
|
||||
|
@@ -16,7 +16,7 @@ use Yii;
|
||||
class ForgotPasswordFormTest extends TestCase {
|
||||
use Specify;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
Yii::$container->set(ReCaptchaValidator::class, new class(mock(ClientInterface::class)) extends ReCaptchaValidator {
|
||||
public function validateValue($value) {
|
||||
@@ -35,7 +35,7 @@ class ForgotPasswordFormTest extends TestCase {
|
||||
public function testValidateLogin() {
|
||||
$model = new ForgotPasswordForm(['login' => 'unexist']);
|
||||
$model->validateLogin('login');
|
||||
$this->assertEquals(['error.login_not_exist'], $model->getErrors('login'), 'error.login_not_exist if login is invalid');
|
||||
$this->assertSame(['error.login_not_exist'], $model->getErrors('login'), 'error.login_not_exist if login is invalid');
|
||||
|
||||
$model = new ForgotPasswordForm(['login' => $this->tester->grabFixture('accounts', 'admin')['username']]);
|
||||
$model->validateLogin('login');
|
||||
@@ -47,7 +47,7 @@ class ForgotPasswordFormTest extends TestCase {
|
||||
'login' => $this->tester->grabFixture('accounts', 'not-activated-account')['username'],
|
||||
]);
|
||||
$model->validateActivity('login');
|
||||
$this->assertEquals(['error.account_not_activated'], $model->getErrors('login'), 'expected error if account is not confirmed');
|
||||
$this->assertSame(['error.account_not_activated'], $model->getErrors('login'), 'expected error if account is not confirmed');
|
||||
|
||||
$model = new ForgotPasswordForm([
|
||||
'login' => $this->tester->grabFixture('accounts', 'admin')['username'],
|
||||
@@ -62,7 +62,7 @@ class ForgotPasswordFormTest extends TestCase {
|
||||
'key' => $this->tester->grabFixture('emailActivations', 'freshPasswordRecovery')['key'],
|
||||
]);
|
||||
$model->validateFrequency('login');
|
||||
$this->assertEquals(['error.recently_sent_message'], $model->getErrors('login'), 'error.account_not_activated if recently was message');
|
||||
$this->assertSame(['error.recently_sent_message'], $model->getErrors('login'), 'error.account_not_activated if recently was message');
|
||||
|
||||
$model = $this->createModel([
|
||||
'login' => $this->tester->grabFixture('accounts', 'admin')['username'],
|
||||
|
@@ -14,13 +14,13 @@ class LoginFormTest extends TestCase {
|
||||
|
||||
private $originalRemoteAddr;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
$this->originalRemoteAddr = $_SERVER['REMOTE_ADDR'] ?? null;
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
protected function tearDown() {
|
||||
parent::tearDown();
|
||||
$_SERVER['REMOTE_ADDR'] = $this->originalRemoteAddr;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class LoginFormTest extends TestCase {
|
||||
'account' => null,
|
||||
]);
|
||||
$model->validateLogin('login');
|
||||
$this->assertEquals(['error.login_not_exist'], $model->getErrors('login'));
|
||||
$this->assertSame(['error.login_not_exist'], $model->getErrors('login'));
|
||||
});
|
||||
|
||||
$this->specify('no errors if login exists', function() {
|
||||
@@ -58,7 +58,7 @@ class LoginFormTest extends TestCase {
|
||||
'account' => new Account(['password' => '12345678']),
|
||||
]);
|
||||
$model->validatePassword('password');
|
||||
$this->assertEquals(['error.password_incorrect'], $model->getErrors('password'));
|
||||
$this->assertSame(['error.password_incorrect'], $model->getErrors('password'));
|
||||
});
|
||||
|
||||
$this->specify('no errors if password valid', function() {
|
||||
@@ -84,7 +84,7 @@ class LoginFormTest extends TestCase {
|
||||
'account' => $account,
|
||||
]);
|
||||
$model->validateTotp('totp');
|
||||
$this->assertEquals(['error.totp_incorrect'], $model->getErrors('totp'));
|
||||
$this->assertSame(['error.totp_incorrect'], $model->getErrors('totp'));
|
||||
});
|
||||
|
||||
$totp = TOTP::create($account->otp_secret);
|
||||
@@ -105,7 +105,7 @@ class LoginFormTest extends TestCase {
|
||||
'account' => new Account(['status' => Account::STATUS_REGISTERED]),
|
||||
]);
|
||||
$model->validateActivity('login');
|
||||
$this->assertEquals(['error.account_not_activated'], $model->getErrors('login'));
|
||||
$this->assertSame(['error.account_not_activated'], $model->getErrors('login'));
|
||||
});
|
||||
|
||||
$this->specify('error.account_banned if account has banned status', function() {
|
||||
@@ -113,7 +113,7 @@ class LoginFormTest extends TestCase {
|
||||
'account' => new Account(['status' => Account::STATUS_BANNED]),
|
||||
]);
|
||||
$model->validateActivity('login');
|
||||
$this->assertEquals(['error.account_banned'], $model->getErrors('login'));
|
||||
$this->assertSame(['error.account_banned'], $model->getErrors('login'));
|
||||
});
|
||||
|
||||
$this->specify('no errors if account active', function() {
|
||||
@@ -146,7 +146,7 @@ class LoginFormTest extends TestCase {
|
||||
]);
|
||||
$this->assertInstanceOf(AuthenticationResult::class, $model->login());
|
||||
$this->assertEmpty($model->getErrors());
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
Account::PASS_HASH_STRATEGY_YII2,
|
||||
$model->getAccount()->password_hash_strategy,
|
||||
'user, that login using account with old pass hash strategy should update it automatically'
|
||||
|
@@ -26,7 +26,7 @@ class RefreshTokenFormTest extends TestCase {
|
||||
}
|
||||
};
|
||||
$model->validateRefreshToken();
|
||||
$this->assertEquals(['error.refresh_token_not_exist'], $model->getErrors('refresh_token'));
|
||||
$this->assertSame(['error.refresh_token_not_exist'], $model->getErrors('refresh_token'));
|
||||
});
|
||||
|
||||
$this->specify('no errors if token exists', function() {
|
||||
|
@@ -20,7 +20,7 @@ use const common\LATEST_RULES_VERSION;
|
||||
|
||||
class RegistrationFormTest extends TestCase {
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->mockRequest();
|
||||
Yii::$container->set(ReCaptchaValidator::class, new class(mock(ClientInterface::class)) extends ReCaptchaValidator {
|
||||
@@ -68,7 +68,7 @@ class RegistrationFormTest extends TestCase {
|
||||
$account = $model->signup();
|
||||
|
||||
$this->expectSuccessRegistration($account);
|
||||
$this->assertEquals('ru', $account->lang, 'lang is set');
|
||||
$this->assertSame('ru', $account->lang, 'lang is set');
|
||||
}
|
||||
|
||||
public function testSignupWithDefaultLanguage() {
|
||||
@@ -84,7 +84,7 @@ class RegistrationFormTest extends TestCase {
|
||||
$account = $model->signup();
|
||||
|
||||
$this->expectSuccessRegistration($account);
|
||||
$this->assertEquals('en', $account->lang, 'lang is set');
|
||||
$this->assertSame('en', $account->lang, 'lang is set');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ class RegistrationFormTest extends TestCase {
|
||||
$this->assertTrue($account->validatePassword('some_password'), 'password should be correct');
|
||||
$this->assertNotEmpty($account->uuid, 'uuid is set');
|
||||
$this->assertNotNull($account->registration_ip, 'registration_ip is set');
|
||||
$this->assertEquals(LATEST_RULES_VERSION, $account->rules_agreement_version, 'actual rules version is set');
|
||||
$this->assertSame(LATEST_RULES_VERSION, $account->rules_agreement_version, 'actual rules version is set');
|
||||
$this->assertTrue(Account::find()->andWhere([
|
||||
'username' => 'some_username',
|
||||
'email' => 'some_email@example.com',
|
||||
|
@@ -15,7 +15,7 @@ use Yii;
|
||||
class RepeatAccountActivationFormTest extends TestCase {
|
||||
use Specify;
|
||||
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
Yii::$container->set(ReCaptchaValidator::class, new class(mock(ClientInterface::class)) extends ReCaptchaValidator {
|
||||
public function validateValue($value) {
|
||||
|
@@ -9,7 +9,7 @@ class ApiFormTest extends TestCase {
|
||||
public function testLoad() {
|
||||
$model = new DummyApiForm();
|
||||
$this->assertTrue($model->load(['field' => 'test-data']), 'model successful load data without prefix');
|
||||
$this->assertEquals('test-data', $model->field, 'field is set as passed data');
|
||||
$this->assertSame('test-data', $model->field, 'field is set as passed data');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user