We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa60b99 commit a2f8dfbCopy full SHA for a2f8dfb
tests/JWTTest.php
@@ -130,6 +130,26 @@ public function testExpiredExceptionPayload()
130
}
131
132
133
+ public function testExpiredExceptionTimestamp()
134
+ {
135
+ $this->expectException(ExpiredException::class);
136
+
137
+ JWT::$timestamp = 98765;
138
+ $payload = [
139
+ 'message' => 'abc',
140
+ 'exp' => 1234,
141
+ ];
142
+ $encoded = JWT::encode($payload, 'my_key', 'HS256');
143
144
+ try {
145
+ JWT::decode($encoded, new Key('my_key', 'HS256'));
146
+ } catch (ExpiredException $e) {
147
+ $exTimestamp = $e->getTimestamp();
148
+ $this->assertSame(98765, $exTimestamp);
149
+ throw $e;
150
+ }
151
152
153
public function testBeforeValidExceptionPayload()
154
{
155
$this->expectException(BeforeValidException::class);
0 commit comments