Skip to content

Commit 5a98f72

Browse files
committed
fix tests
1 parent e5f9a53 commit 5a98f72

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ jobs:
5353
php-version: '8.0'
5454
- name: Run Script
5555
run: |
56+
composer install
5657
composer global require phpstan/phpstan
5758
~/.composer/vendor/bin/phpstan analyse

tests/CachedKeySetTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,21 @@ public function testJwtVerify()
211211
/**
212212
* @dataProvider provideFullIntegration
213213
*/
214-
public function testFullIntegration($jwkUri, $kid)
214+
public function testFullIntegration($jwkUri)
215215
{
216+
// Create cache and http objects
216217
$cache = new TestMemoryCacheItemPool();
217218
$http = new \GuzzleHttp\Client();
218219
$factory = new \GuzzleHttp\Psr7\HttpFactory();
219220

221+
// Determine "kid" dynamically, because these constantly change
222+
$response = $http->get($jwkUri);
223+
$json = (string) $response->getBody();
224+
$keys = json_decode($json, true);
225+
$kid = $keys['keys'][0]['kid'] ?? null;
226+
$this->assertNotNull($kid);
227+
228+
// Instantiate the cached key set
220229
$cachedKeySet = new CachedKeySet(
221230
$jwkUri,
222231
$http,
@@ -230,7 +239,7 @@ public function testFullIntegration($jwkUri, $kid)
230239
public function provideFullIntegration()
231240
{
232241
return [
233-
[$this->googleRsaUri, '182e450a35a2081faa1d9ae1d2d75a0f23d91df8'],
242+
[$this->googleRsaUri],
234243
// [$this->googleEcUri, 'LYyP2g']
235244
];
236245
}

0 commit comments

Comments
 (0)