mirror of
https://github.com/elyby/accounts.git
synced 2024-10-30 15:33:21 +05:30
c0aa78d156
Completely removed usage of the RabbitMQ. Queue now based on Redis channels. Worker process now extracted as separate docker container. Base image upgraded to the 1.8.0 version (PHP 7.2.7 and pcntl extension).
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace tests\codeception\common\unit\tasks;
|
|
|
|
use common\models\Account;
|
|
use common\tasks\ClearAccountSessions;
|
|
use tests\codeception\common\fixtures;
|
|
use tests\codeception\common\unit\TestCase;
|
|
use yii\queue\Queue;
|
|
|
|
/**
|
|
* @covers \common\tasks\ClearAccountSessions
|
|
*/
|
|
class ClearAccountSessionsTest extends TestCase {
|
|
|
|
public function _fixtures() {
|
|
return [
|
|
'accounts' => fixtures\AccountFixture::class,
|
|
'oauthSessions' => fixtures\OauthSessionFixture::class,
|
|
'minecraftAccessKeys' => fixtures\MinecraftAccessKeyFixture::class,
|
|
'authSessions' => fixtures\AccountSessionFixture::class,
|
|
];
|
|
}
|
|
|
|
public function testCreateFromAccount() {
|
|
$account = new Account();
|
|
$account->id = 123;
|
|
$task = ClearAccountSessions::createFromAccount($account);
|
|
$this->assertSame(123, $task->accountId);
|
|
}
|
|
|
|
public function testExecute() {
|
|
/** @var \common\models\Account $bannedAccount */
|
|
$bannedAccount = $this->tester->grabFixture('accounts', 'banned-account');
|
|
$task = new ClearAccountSessions();
|
|
$task->accountId = $bannedAccount->id;
|
|
$task->execute(mock(Queue::class));
|
|
$this->assertEmpty($bannedAccount->sessions);
|
|
$this->assertEmpty($bannedAccount->minecraftAccessKeys);
|
|
$this->assertEmpty($bannedAccount->oauthSessions);
|
|
}
|
|
|
|
}
|