@@ -547,33 +547,30 @@ public function testAdditionalHeaderOverrides()
547
547
$ this ->assertEquals ('HS256 ' , $ headers ->alg , 'alg param not overridden ' );
548
548
}
549
549
550
- public function testDecodeExpectsIntegerIat ()
551
- {
552
- $ this ->expectException (UnexpectedValueException::class);
553
- $ this ->expectExceptionMessage ('Payload iat must be a number ' );
554
- JWT ::decode (
555
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsImlhdCI6InRlc3QifQ.B8cbURVQAPay3-Ep0DAm1Ji2rhij-hxfNA5PIDarf5o ' ,
556
- new Key ('secret ' , 'HS256 ' )
557
- );
558
- }
559
-
560
- public function testDecodeExpectsIntegerNbf ()
561
- {
562
- $ this ->expectException (UnexpectedValueException::class);
563
- $ this ->expectExceptionMessage ('Payload nbf must be a number ' );
564
- JWT ::decode (
565
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsIm5iZiI6InRlc3QifQ.9KdFz3ktQoPO5QFG3E7J86PEuw5Vmx0VPrUKszP7DDs ' ,
566
- new Key ('secret ' , 'HS256 ' )
567
- );
568
- }
569
-
570
- public function testDecodeExpectsIntegerExp ()
571
- {
572
- $ this ->expectException (UnexpectedValueException::class);
573
- $ this ->expectExceptionMessage ('Payload exp must be a number ' );
574
- JWT ::decode (
575
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsImV4cCI6InRlc3QifQ.LXevvGvchI3PTBZo9jZ5-4d0OvONVU-_8Tbg_22-PTo ' ,
576
- new Key ('secret ' , 'HS256 ' )
577
- );
578
- }
550
+ public function testDecodeExpectsIntegerIat ()
551
+ {
552
+ $ this ->expectException (UnexpectedValueException::class);
553
+ $ this ->expectExceptionMessage ('Payload iat must be a number ' );
554
+
555
+ $ payload = JWT ::encode (['iat ' => 'not-an-int ' ], 'secret ' , 'HS256 ' );
556
+ JWT ::decode ($ payload , new Key ('secret ' , 'HS256 ' ));
557
+ }
558
+
559
+ public function testDecodeExpectsIntegerNbf ()
560
+ {
561
+ $ this ->expectException (UnexpectedValueException::class);
562
+ $ this ->expectExceptionMessage ('Payload nbf must be a number ' );
563
+
564
+ $ payload = JWT ::encode (['nbf ' => 'not-an-int ' ], 'secret ' , 'HS256 ' );
565
+ JWT ::decode ($ payload , new Key ('secret ' , 'HS256 ' ));
566
+ }
567
+
568
+ public function testDecodeExpectsIntegerExp ()
569
+ {
570
+ $ this ->expectException (UnexpectedValueException::class);
571
+ $ this ->expectExceptionMessage ('Payload exp must be a number ' );
572
+
573
+ $ payload = JWT ::encode (['exp ' => 'not-an-int ' ], 'secret ' , 'HS256 ' );
574
+ JWT ::decode ($ payload , new Key ('secret ' , 'HS256 ' ));
575
+ }
579
576
}
0 commit comments