Skip to content

Commit 7c8089a

Browse files
svenzikmrts
authored andcommitted
Fix failed test with error User certificate has expired
WE2-985 Signed-off-by: Sven Mitt <[email protected]>
1 parent 1fc6155 commit 7c8089a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/validator/AuthTokenSignatureTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626

2727
namespace web_eid\web_eid_authtoken_validation_php\validator;
2828

29+
use DateTime;
2930
use web_eid\web_eid_authtoken_validation_php\testutil\AbstractTestWithValidator;
3031
use web_eid\web_eid_authtoken_validation_php\certificate\CertificateData;
3132
use web_eid\web_eid_authtoken_validation_php\exceptions\AuthTokenSignatureValidationException;
3233
use web_eid\web_eid_authtoken_validation_php\testutil\AuthTokenValidators;
34+
use web_eid\web_eid_authtoken_validation_php\testutil\Dates;
3335

3436
class AuthTokenSignatureTest extends AbstractTestWithValidator
3537
{
@@ -40,6 +42,11 @@ class AuthTokenSignatureTest extends AbstractTestWithValidator
4042
'"signature":"arx164xRiwhIQDINe0J+ZxJWZFOQTx0PBtOaWaxAe7gofEIHRIbV1w0sOCYBJnvmvMem9hU4nc2+iJx2x8poYck4Z6eI3GwtiksIec3XQ9ZIk1n/XchXnmPn3GYV+HzJ",' .
4143
'"format":"web-eid:1.0"}';
4244

45+
protected function tearDown(): void
46+
{
47+
Dates::resetMockedCertificateValidatorDate();
48+
}
49+
4350
public function testWhenValidTokenAndNonceThenValidationSucceeds(): void
4451
{
4552
$result = $this->validator->validate($this->validAuthToken, self::VALID_CHALLENGE_NONCE);
@@ -68,6 +75,7 @@ public function testWhenValidTokenAndWrongOriginThenValidationFails(): void
6875

6976
public function testWhenTokenWithWrongCertThenValidationFails(): void
7077
{
78+
Dates::setMockedCertificateValidatorDate(new DateTime('2024-08-01 10:13:43.000'));
7179
$authTokenValidator = AuthTokenValidators::getAuthTokenValidator();
7280
$authTokenWithWrongCert = $authTokenValidator->parse(self::AUTH_TOKEN_WRONG_CERT);
7381

0 commit comments

Comments
 (0)