mirror of
https://github.com/elyby/accounts.git
synced 2024-12-25 22:59:53 +05:30
34 lines
982 B
PHP
34 lines
982 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace common\tests\unit\tasks;
|
|
|
|
use common\tasks\ClearAccountSessions;
|
|
use common\tests\fixtures;
|
|
use common\tests\unit\TestCase;
|
|
use yii\queue\Queue;
|
|
|
|
/**
|
|
* @covers \common\tasks\ClearAccountSessions
|
|
*/
|
|
class ClearAccountSessionsTest extends TestCase {
|
|
|
|
public function _fixtures(): array {
|
|
return [
|
|
'accounts' => fixtures\AccountFixture::class,
|
|
'oauthSessions' => fixtures\OauthSessionFixture::class,
|
|
'authSessions' => fixtures\AccountSessionFixture::class,
|
|
];
|
|
}
|
|
|
|
public function testExecute() {
|
|
/** @var \common\models\Account $bannedAccount */
|
|
$bannedAccount = $this->tester->grabFixture('accounts', 'banned-account');
|
|
$task = new ClearAccountSessions($bannedAccount->id);
|
|
$task->execute($this->createMock(Queue::class));
|
|
$this->assertEmpty($bannedAccount->sessions);
|
|
$this->assertEmpty($bannedAccount->oauthSessions);
|
|
}
|
|
|
|
}
|