@@ 161-168 (lines=8) @@ | ||
158 | /** |
|
159 | * @test |
|
160 | */ |
|
161 | public function validationWillFailWhenExpiredByExp() |
|
162 | { |
|
163 | $this->expectException(InvalidTimeException::class); |
|
164 | $this->expectExceptionMessage("Token is expired by 'exp'"); |
|
165 | ||
166 | $key = new JwtKey(['secret' => 'Buy the book']); |
|
167 | $key->validateClaims(['sub' => 'john', 'exp' => time() - 2]); |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * @test |
|
@@ 193-200 (lines=8) @@ | ||
190 | /** |
|
191 | * @test |
|
192 | */ |
|
193 | public function validationWillFailWhenNotValidYet() |
|
194 | { |
|
195 | $this->expectException(InvalidTimeException::class); |
|
196 | $this->expectExceptionMessage("Token not valid yet"); |
|
197 | ||
198 | $key = new JwtKey(['secret' => 'Buy the book']); |
|
199 | $key->validateClaims(['sub' => 'john', 'nbf' => time() + 2]); |
|
200 | } |
|
201 | ||
202 | /** |
|
203 | * @test |