Skip to content

Commit 1e98c2d

Browse files
committed
Get rid off RevokeTokenByAuthCodeIdTrait
1 parent f63818a commit 1e98c2d

File tree

2 files changed

+4
-72
lines changed

2 files changed

+4
-72
lines changed

src/Repositories/Traits/RevokeTokenByAuthCodeIdTrait.php

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
declare(strict_types=1);
44

5-
namespace SimpleSAML\Test\Module\oidc\integration\Repositories\Traits;
5+
namespace SimpleSAML\Test\Module\oidc\integration\Repositories;
66

77
use League\OAuth2\Server\CryptKey;
88
use PDO;
9+
use PHPUnit\Framework\Attributes\CoversClass;
910
use PHPUnit\Framework\Attributes\DataProvider;
1011
use PHPUnit\Framework\MockObject\MockObject;
1112
use PHPUnit\Framework\TestCase;
@@ -25,7 +26,6 @@
2526
use SimpleSAML\Module\oidc\Repositories\AbstractDatabaseRepository;
2627
use SimpleSAML\Module\oidc\Repositories\AccessTokenRepository;
2728
use SimpleSAML\Module\oidc\Repositories\ClientRepository;
28-
use SimpleSAML\Module\oidc\Repositories\Traits\RevokeTokenByAuthCodeIdTrait;
2929
use SimpleSAML\Module\oidc\Repositories\UserRepository;
3030
use SimpleSAML\Module\oidc\Services\DatabaseMigration;
3131
use SimpleSAML\Module\oidc\Services\JsonWebTokenBuilderService;
@@ -34,10 +34,8 @@
3434
use Testcontainers\Wait\WaitForHealthCheck;
3535
use Testcontainers\Wait\WaitForLog;
3636

37-
/**
38-
* @covers \SimpleSAML\Module\oidc\Repositories\Traits\RevokeTokenByAuthCodeIdTrait
39-
*/
40-
class RevokeTokenByAuthCodeIdTraitTest extends TestCase
37+
#[CoversClass(AccessTokenRepository::class)]
38+
class AccessTokenRepositoryTest extends TestCase
4139
{
4240
protected array $state;
4341
protected array $scopes;
@@ -139,18 +137,11 @@ public function useDatabase($config): void
139137
$moduleConfig = new ModuleConfig();
140138

141139
$this->mock = new class ($moduleConfig, $database, null) extends AbstractDatabaseRepository {
142-
use RevokeTokenByAuthCodeIdTrait;
143-
144140
public function getTableName(): ?string
145141
{
146142
return $this->database->applyPrefix('oidc_access_token');
147143
}
148144

149-
public function generateQueryWrapper(string $authCodeId, array $revokedParam): array
150-
{
151-
return $this->generateQuery($authCodeId, $revokedParam);
152-
}
153-
154145
public function getDatabase(): Database
155146
{
156147
return $this->database;
@@ -291,26 +282,6 @@ public static function databaseToTest(): array
291282
];
292283
}
293284

294-
#[DataProvider('databaseToTest')]
295-
public function testItGenerateQuery(string $database): void
296-
{
297-
$this->useDatabase(self::$$database);
298-
299-
$revokedParam = [self::IS_REVOKED, PDO::PARAM_BOOL];
300-
$expected = [
301-
'UPDATE phpunit_oidc_access_token SET is_revoked = :is_revoked WHERE auth_code_id = :auth_code_id',
302-
[
303-
'auth_code_id' => self::AUTH_CODE_ID,
304-
'is_revoked' => $revokedParam,
305-
],
306-
];
307-
308-
$this->assertEquals(
309-
$expected,
310-
$this->mock->generateQueryWrapper(self::AUTH_CODE_ID, $revokedParam),
311-
);
312-
}
313-
314285
/**
315286
* @throws \JsonException
316287
* @throws \League\OAuth2\Server\Exception\UniqueTokenIdentifierConstraintViolationException

0 commit comments

Comments
 (0)