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:
@@ -16,7 +16,7 @@ class AcceptRulesFormTest extends TestCase {
|
||||
|
||||
$model = new AcceptRulesForm($account);
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals(LATEST_RULES_VERSION, $account->rules_agreement_version);
|
||||
$this->assertSame(LATEST_RULES_VERSION, $account->rules_agreement_version);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ChangeEmailFormTest extends TestCase {
|
||||
]));
|
||||
/** @noinspection UnserializeExploitsInspection */
|
||||
$data = unserialize($newEmailConfirmationFixture['_data']);
|
||||
$this->assertEquals($data['newEmail'], $account->email);
|
||||
$this->assertSame($data['newEmail'], $account->email);
|
||||
}
|
||||
|
||||
private function getAccountId() {
|
||||
|
||||
@@ -15,7 +15,7 @@ class ChangeLanguageFormTest extends TestCase {
|
||||
$model = new ChangeLanguageForm($account);
|
||||
$model->lang = 'ru';
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals('ru', $account->lang);
|
||||
$this->assertSame('ru', $account->lang);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ChangePasswordFormTest extends TestCase {
|
||||
'newRePassword' => 'another-password',
|
||||
]);
|
||||
$model->validatePasswordAndRePasswordMatch('newRePassword');
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
[E::NEW_RE_PASSWORD_DOES_NOT_MATCH],
|
||||
$model->getErrors('newRePassword'),
|
||||
'error.rePassword_does_not_match expected if passwords not match'
|
||||
@@ -47,7 +47,7 @@ class ChangePasswordFormTest extends TestCase {
|
||||
'newRePassword' => 'another-password',
|
||||
]);
|
||||
$model->validate();
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
[E::NEW_RE_PASSWORD_DOES_NOT_MATCH],
|
||||
$model->getErrors('newRePassword'),
|
||||
'error.rePassword_does_not_match expected even if there are errors on other attributes'
|
||||
@@ -106,7 +106,7 @@ class ChangePasswordFormTest extends TestCase {
|
||||
$this->assertTrue($model->performAction(), 'successfully change password with legacy hash strategy');
|
||||
$this->assertTrue($account->validatePassword('my-new-password'));
|
||||
$this->assertGreaterThanOrEqual($callTime, $account->password_changed_at);
|
||||
$this->assertEquals(Account::PASS_HASH_STRATEGY_YII2, $account->password_hash_strategy);
|
||||
$this->assertSame(Account::PASS_HASH_STRATEGY_YII2, $account->password_hash_strategy);
|
||||
}
|
||||
|
||||
public function testPerformActionWithLogout() {
|
||||
|
||||
@@ -24,7 +24,7 @@ class ChangeUsernameFormTest extends TestCase {
|
||||
'username' => 'my_new_nickname',
|
||||
]);
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals('my_new_nickname', Account::findOne($this->getAccountId())->username);
|
||||
$this->assertSame('my_new_nickname', Account::findOne($this->getAccountId())->username);
|
||||
$this->assertInstanceOf(UsernameHistory::class, UsernameHistory::findOne(['username' => 'my_new_nickname']));
|
||||
/** @var PullMojangUsername $job */
|
||||
$job = $this->tester->grabLastQueuedJob();
|
||||
@@ -56,7 +56,7 @@ class ChangeUsernameFormTest extends TestCase {
|
||||
'username' => $newUsername,
|
||||
]);
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals($newUsername, Account::findOne($this->getAccountId())->username);
|
||||
$this->assertSame($newUsername, Account::findOne($this->getAccountId())->username);
|
||||
$this->assertInstanceOf(
|
||||
UsernameHistory::class,
|
||||
UsernameHistory::findOne(['username' => $newUsername]),
|
||||
|
||||
@@ -30,7 +30,7 @@ class DisableTwoFactorAuthFormTest extends TestCase {
|
||||
$account->is_otp_enabled = false;
|
||||
$model = new DisableTwoFactorAuthForm($account);
|
||||
$model->validateOtpEnabled('account');
|
||||
$this->assertEquals([E::OTP_NOT_ENABLED], $model->getErrors('account'));
|
||||
$this->assertSame([E::OTP_NOT_ENABLED], $model->getErrors('account'));
|
||||
|
||||
$account = new Account();
|
||||
$account->is_otp_enabled = true;
|
||||
|
||||
@@ -42,7 +42,7 @@ class EnableTwoFactorAuthFormTest extends TestCase {
|
||||
$account->is_otp_enabled = true;
|
||||
$model = new EnableTwoFactorAuthForm($account);
|
||||
$model->validateOtpDisabled('account');
|
||||
$this->assertEquals([E::OTP_ALREADY_ENABLED], $model->getErrors('account'));
|
||||
$this->assertSame([E::OTP_ALREADY_ENABLED], $model->getErrors('account'));
|
||||
|
||||
$account = new Account();
|
||||
$account->is_otp_enabled = false;
|
||||
|
||||
@@ -25,7 +25,7 @@ class SendEmailVerificationFormTest extends TestCase {
|
||||
$model = new SendEmailVerificationForm($account);
|
||||
$activationModel = $model->createCode();
|
||||
$this->assertInstanceOf(CurrentEmailConfirmation::class, $activationModel);
|
||||
$this->assertEquals($account->id, $activationModel->account_id);
|
||||
$this->assertSame($account->id, $activationModel->account_id);
|
||||
$this->assertNotNull(EmailActivation::findOne($activationModel->key));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ class SendNewEmailVerificationFormTest extends TestCase {
|
||||
$model->email = 'my-new-email@ely.by';
|
||||
$activationModel = $model->createCode();
|
||||
$this->assertInstanceOf(NewEmailConfirmation::class, $activationModel);
|
||||
$this->assertEquals($account->id, $activationModel->account_id);
|
||||
$this->assertEquals($model->email, $activationModel->newEmail);
|
||||
$this->assertSame($account->id, $activationModel->account_id);
|
||||
$this->assertSame($model->email, $activationModel->newEmail);
|
||||
$this->assertNotNull(EmailActivation::findOne($activationModel->key));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class TwoFactorAuthInfoTest extends TestCase {
|
||||
$model = new TwoFactorAuthInfo($account);
|
||||
|
||||
$result = $model->getCredentials();
|
||||
$this->assertEquals('AAAA', $result['secret']);
|
||||
$this->assertSame('AAAA', $result['secret']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class AuthenticationFormTest extends TestCase {
|
||||
|
||||
$result = $authForm->authenticate();
|
||||
$this->assertInstanceOf(AuthenticateData::class, $result);
|
||||
$this->assertEquals($minecraftAccessKey->access_token, $result->getMinecraftAccessKey()->access_token);
|
||||
$this->assertSame($minecraftAccessKey->access_token, $result->getMinecraftAccessKey()->access_token);
|
||||
}
|
||||
|
||||
public function testCreateMinecraftAccessToken() {
|
||||
@@ -90,8 +90,8 @@ class AuthenticationFormTest extends TestCase {
|
||||
/** @var MinecraftAccessKey $result */
|
||||
$result = $this->callProtected($authForm, 'createMinecraftAccessToken', $account);
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, $result);
|
||||
$this->assertEquals($account->id, $result->account_id);
|
||||
$this->assertEquals($authForm->clientToken, $result->client_token);
|
||||
$this->assertSame($account->id, $result->account_id);
|
||||
$this->assertSame($authForm->clientToken, $result->client_token);
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, MinecraftAccessKey::findOne($result->access_token));
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ class AuthenticationFormTest extends TestCase {
|
||||
/** @var MinecraftAccessKey $result */
|
||||
$result = $this->callProtected($authForm, 'createMinecraftAccessToken', $account);
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, $result);
|
||||
$this->assertEquals($account->id, $result->account_id);
|
||||
$this->assertEquals($authForm->clientToken, $result->client_token);
|
||||
$this->assertSame($account->id, $result->account_id);
|
||||
$this->assertSame($authForm->clientToken, $result->client_token);
|
||||
$this->assertNull(MinecraftAccessKey::findOne($minecraftFixture['access_token']));
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, MinecraftAccessKey::findOne($result->access_token));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class BanFormTest extends TestCase {
|
||||
$account->status = Account::STATUS_BANNED;
|
||||
$form = new BanAccountForm($account);
|
||||
$form->validateAccountActivity();
|
||||
$this->assertEquals([E::ACCOUNT_ALREADY_BANNED], $form->getErrors('account'));
|
||||
$this->assertSame([E::ACCOUNT_ALREADY_BANNED], $form->getErrors('account'));
|
||||
}
|
||||
|
||||
public function testBan() {
|
||||
@@ -35,7 +35,7 @@ class BanFormTest extends TestCase {
|
||||
|
||||
$model = new BanAccountForm($account);
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals(Account::STATUS_BANNED, $account->status);
|
||||
$this->assertSame(Account::STATUS_BANNED, $account->status);
|
||||
/** @var ClearAccountSessions $job */
|
||||
$job = $this->tester->grabLastQueuedJob();
|
||||
$this->assertInstanceOf(ClearAccountSessions::class, $job);
|
||||
|
||||
@@ -19,7 +19,7 @@ class PardonFormTest extends TestCase {
|
||||
$account->status = Account::STATUS_ACTIVE;
|
||||
$form = new PardonAccountForm($account);
|
||||
$form->validateAccountBanned();
|
||||
$this->assertEquals([E::ACCOUNT_NOT_BANNED], $form->getErrors('account'));
|
||||
$this->assertSame([E::ACCOUNT_NOT_BANNED], $form->getErrors('account'));
|
||||
}
|
||||
|
||||
public function testPardon() {
|
||||
@@ -35,7 +35,7 @@ class PardonFormTest extends TestCase {
|
||||
$account->status = Account::STATUS_BANNED;
|
||||
$model = new PardonAccountForm($account);
|
||||
$this->assertTrue($model->performAction());
|
||||
$this->assertEquals(Account::STATUS_ACTIVE, $account->status);
|
||||
$this->assertSame(Account::STATUS_ACTIVE, $account->status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class OauthClientFormTest extends TestCase {
|
||||
$job = $this->tester->grabLastQueuedJob();
|
||||
$this->assertInstanceOf(ClearOauthSessions::class, $job);
|
||||
$this->assertSame('mocked-id', $job->clientId);
|
||||
$this->assertEquals(time(), $job->notSince, '', 2);
|
||||
$this->assertEqualsWithDelta(time(), $job->notSince, 2);
|
||||
}
|
||||
|
||||
public function testResetWithSecret() {
|
||||
@@ -132,7 +132,7 @@ class OauthClientFormTest extends TestCase {
|
||||
$job = $this->tester->grabLastQueuedJob();
|
||||
$this->assertInstanceOf(ClearOauthSessions::class, $job);
|
||||
$this->assertSame('mocked-id', $job->clientId);
|
||||
$this->assertEquals(time(), $job->notSince, '', 2);
|
||||
$this->assertEqualsWithDelta(time(), $job->notSince, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user