public function JWKFetcherTest::testThatGetFormattedUsesCache in Auth0 Single Sign On 8.2
File
- vendor/
auth0/ auth0-php/ tests/ Helpers/ JWKFetcherTest.php, line 54
Class
- JWKFetcherTest
- Class JWKFetcherTest.
Namespace
Auth0\Tests\HelpersCode
public function testThatGetFormattedUsesCache() {
$jwks_body_1 = '{"keys":[{"kid":"abc","x5c":["123"]}]}';
$jwks_body_2 = '{"keys":[{"kid":"def","x5c":["456"]}]}';
$jwks = new MockJwks([
new Response(200, [
'Content-Type' => 'application/json',
], $jwks_body_1),
new Response(200, [
'Content-Type' => 'application/json',
], $jwks_body_2),
], [
'cache' => new FileSystemCacheHandler(),
]);
$jwks_formatted_1 = $jwks
->call()
->getKeys('__test_url__');
$this
->assertArrayHasKey('abc', $jwks_formatted_1);
$this
->assertContains('123', $jwks_formatted_1['abc']);
$jwks_formatted_2 = $jwks
->call()
->getKeys('__test_url__');
$this
->assertEquals($jwks_formatted_1, $jwks_formatted_2);
}