mirror of
https://github.com/elyby/accounts.git
synced 2024-12-13 17:09:00 +05:30
32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
namespace codeception\console\unit\controllers;
|
|
|
|
use common\models\OauthAccessToken;
|
|
use console\controllers\CleanupController;
|
|
use tests\codeception\common\fixtures\OauthAccessTokenFixture;
|
|
use tests\codeception\console\unit\TestCase;
|
|
use Yii;
|
|
|
|
class CleanupControllerTest extends TestCase {
|
|
|
|
public function _fixtures() {
|
|
return [
|
|
'accessTokens' => OauthAccessTokenFixture::class,
|
|
];
|
|
}
|
|
|
|
public function testActionAccessTokens() {
|
|
/** @var OauthAccessToken $validAccessToken */
|
|
$validAccessToken = $this->tester->grabFixture('accessTokens', 'admin-test1');
|
|
/** @var OauthAccessToken $expiredAccessToken */
|
|
$expiredAccessToken = $this->tester->grabFixture('accessTokens', 'admin-test1-expired');
|
|
|
|
$controller = new CleanupController('cleanup', Yii::$app);
|
|
$this->assertEquals(0, $controller->actionAccessTokens());
|
|
|
|
$this->tester->canSeeRecord(OauthAccessToken::class, ['access_token' => $validAccessToken->access_token]);
|
|
$this->tester->cantSeeRecord(OauthAccessToken::class, ['access_token' => $expiredAccessToken->access_token]);
|
|
}
|
|
|
|
}
|