|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -namespace SimpleSAML\Test\Module\oidc\integration\Repositories\Traits; |
| 5 | +namespace SimpleSAML\Test\Module\oidc\integration\Repositories; |
6 | 6 |
|
7 | 7 | use League\OAuth2\Server\CryptKey; |
8 | 8 | use PDO; |
| 9 | +use PHPUnit\Framework\Attributes\CoversClass; |
9 | 10 | use PHPUnit\Framework\Attributes\DataProvider; |
10 | 11 | use PHPUnit\Framework\MockObject\MockObject; |
11 | 12 | use PHPUnit\Framework\TestCase; |
|
25 | 26 | use SimpleSAML\Module\oidc\Repositories\AbstractDatabaseRepository; |
26 | 27 | use SimpleSAML\Module\oidc\Repositories\AccessTokenRepository; |
27 | 28 | use SimpleSAML\Module\oidc\Repositories\ClientRepository; |
28 | | -use SimpleSAML\Module\oidc\Repositories\Traits\RevokeTokenByAuthCodeIdTrait; |
29 | 29 | use SimpleSAML\Module\oidc\Repositories\UserRepository; |
30 | 30 | use SimpleSAML\Module\oidc\Services\DatabaseMigration; |
31 | 31 | use SimpleSAML\Module\oidc\Services\JsonWebTokenBuilderService; |
|
34 | 34 | use Testcontainers\Wait\WaitForHealthCheck; |
35 | 35 | use Testcontainers\Wait\WaitForLog; |
36 | 36 |
|
37 | | -/** |
38 | | - * @covers \SimpleSAML\Module\oidc\Repositories\Traits\RevokeTokenByAuthCodeIdTrait |
39 | | - */ |
40 | | -class RevokeTokenByAuthCodeIdTraitTest extends TestCase |
| 37 | +#[CoversClass(AccessTokenRepository::class)] |
| 38 | +class AccessTokenRepositoryTest extends TestCase |
41 | 39 | { |
42 | 40 | protected array $state; |
43 | 41 | protected array $scopes; |
@@ -139,18 +137,11 @@ public function useDatabase($config): void |
139 | 137 | $moduleConfig = new ModuleConfig(); |
140 | 138 |
|
141 | 139 | $this->mock = new class ($moduleConfig, $database, null) extends AbstractDatabaseRepository { |
142 | | - use RevokeTokenByAuthCodeIdTrait; |
143 | | - |
144 | 140 | public function getTableName(): ?string |
145 | 141 | { |
146 | 142 | return $this->database->applyPrefix('oidc_access_token'); |
147 | 143 | } |
148 | 144 |
|
149 | | - public function generateQueryWrapper(string $authCodeId, array $revokedParam): array |
150 | | - { |
151 | | - return $this->generateQuery($authCodeId, $revokedParam); |
152 | | - } |
153 | | - |
154 | 145 | public function getDatabase(): Database |
155 | 146 | { |
156 | 147 | return $this->database; |
@@ -291,26 +282,6 @@ public static function databaseToTest(): array |
291 | 282 | ]; |
292 | 283 | } |
293 | 284 |
|
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 | | - |
314 | 285 | /** |
315 | 286 | * @throws \JsonException |
316 | 287 | * @throws \League\OAuth2\Server\Exception\UniqueTokenIdentifierConstraintViolationException |
|
0 commit comments