Skip to content

Commit 02fd765

Browse files
committed
JWT validate test: Stronger assertions, in order not to miss a case where the cache was not written and the validation was always done against Gigya
1 parent 0dcfc7f commit 02fd765

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/JWTUtilsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function testValidateSignature(string $apiKey, string $apiDomain, string
6262
if (file_exists($cacheFilePath)) {
6363
unlink($cacheFilePath);
6464
}
65+
$this->assertFileNotExists($cacheFilePath);
6566

6667
$jwt = $this->getJWT($apiKey, $apiDomain, $userKey, $privateKey, $uid);
6768
$this->assertNotFalse($jwt);
@@ -73,6 +74,8 @@ public function testValidateSignature(string $apiKey, string $apiDomain, string
7374
$this->assertNotEmpty($claims->email);
7475

7576
JWTUtils::validateSignature($jwt, $apiKey, $apiDomain); /* This one writes to the cache */
77+
$this->assertFileExists($cacheFilePath);
78+
7679
$claims = JWTUtils::validateSignature($jwt, $apiKey, $apiDomain); /* This one validates against the cache */
7780
$this->assertEquals($claims->apiKey, $apiKey);
7881
$this->assertEquals($claims->sub, $uid);

0 commit comments

Comments
 (0)