mirror of
https://github.com/elyby/accounts.git
synced 2024-12-27 15:40:21 +05:30
Фикс бага с повторным добавлением аккаунта в authserver
This commit is contained in:
parent
bafac25baf
commit
4b6bfa15ec
@ -80,6 +80,7 @@ class AuthenticationForm extends Form {
|
||||
$accessTokenModel->insert();
|
||||
} else {
|
||||
$accessTokenModel->refreshPrimaryKeyValue();
|
||||
$accessTokenModel->update();
|
||||
}
|
||||
|
||||
return $accessTokenModel;
|
||||
|
@ -89,7 +89,6 @@ class AuthenticationFormTest extends DbTestCase {
|
||||
|
||||
public function testCreateMinecraftAccessToken() {
|
||||
$authForm = new AuthenticationForm();
|
||||
$fixturesCount = count($this->minecraftAccessKeys->data);
|
||||
$authForm->clientToken = Uuid::uuid4();
|
||||
/** @var Account $account */
|
||||
$account = $this->accounts->getModel('admin');
|
||||
@ -98,12 +97,11 @@ class AuthenticationFormTest extends DbTestCase {
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, $result);
|
||||
$this->assertEquals($account->id, $result->account_id);
|
||||
$this->assertEquals($authForm->clientToken, $result->client_token);
|
||||
$this->assertEquals($fixturesCount + 1, MinecraftAccessKey::find()->count());
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, MinecraftAccessKey::findOne($result->access_token));
|
||||
}
|
||||
|
||||
public function testCreateMinecraftAccessTokenWithExistsClientId() {
|
||||
$authForm = new AuthenticationForm();
|
||||
$fixturesCount = count($this->minecraftAccessKeys->data);
|
||||
$authForm->clientToken = $this->minecraftAccessKeys['admin-token']['client_token'];
|
||||
/** @var Account $account */
|
||||
$account = $this->accounts->getModel('admin');
|
||||
@ -112,7 +110,8 @@ class AuthenticationFormTest extends DbTestCase {
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, $result);
|
||||
$this->assertEquals($account->id, $result->account_id);
|
||||
$this->assertEquals($authForm->clientToken, $result->client_token);
|
||||
$this->assertEquals($fixturesCount, MinecraftAccessKey::find()->count());
|
||||
$this->assertNull(MinecraftAccessKey::findOne($this->minecraftAccessKeys['admin-token']['access_token']));
|
||||
$this->assertInstanceOf(MinecraftAccessKey::class, MinecraftAccessKey::findOne($result->access_token));
|
||||
}
|
||||
|
||||
private function createAuthForm($status = Account::STATUS_ACTIVE) {
|
||||
@ -143,5 +142,4 @@ class AuthenticationFormTest extends DbTestCase {
|
||||
return $authForm;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user