@@ -38,35 +38,29 @@ public function testMalformedJsonThrowsException()
3838 public function testExpiredToken ()
3939 {
4040 $ this ->setExpectedException ('ExpiredException ' );
41- $ timeInPast = time () - 20 ;
4241 $ payload = array (
4342 "message " => "abc " ,
44- "exp " => $ timeInPast // time in the past
45- );
43+ "exp " => time () - 20 ); // time in the past
4644 $ encoded = JWT ::encode ($ payload , 'my_key ' );
4745 JWT ::decode ($ encoded , 'my_key ' , array ('HS256 ' ));
4846 }
4947
5048 public function testBeforeValidTokenWithNbf ()
5149 {
5250 $ this ->setExpectedException ('BeforeValidException ' );
53- $ timeInFuture = time () + 20 ;
5451 $ payload = array (
5552 "message " => "abc " ,
56- "nbf " => $ timeInFuture // time in the future
57- );
53+ "nbf " => time () + 20 ); // time in the future
5854 $ encoded = JWT ::encode ($ payload , 'my_key ' );
5955 JWT ::decode ($ encoded , 'my_key ' , array ('HS256 ' ));
6056 }
6157
6258 public function testBeforeValidTokenWithIat ()
6359 {
6460 $ this ->setExpectedException ('BeforeValidException ' );
65- $ timeInFuture = time () + 20 ;
6661 $ payload = array (
6762 "message " => "abc " ,
68- "iat " => $ timeInFuture // time in the future
69- );
63+ "iat " => time () + 20 ); // time in the future
7064 $ encoded = JWT ::encode ($ payload , 'my_key ' );
7165 JWT ::decode ($ encoded , 'my_key ' , array ('HS256 ' ));
7266 }
0 commit comments