@@ -75,6 +75,16 @@ public function testValidToken()
75
75
$ this ->assertEquals ($ decoded ->message , 'abc ' );
76
76
}
77
77
78
+ public function testValidTokenWithList ()
79
+ {
80
+ $ payload = array (
81
+ "message " => "abc " ,
82
+ "exp " => time () + 20 ); // time in the future
83
+ $ encoded = JWT ::encode ($ payload , 'my_key ' );
84
+ $ decoded = JWT ::decode ($ encoded , 'my_key ' , array ('HS256 ' , 'HS512 ' ));
85
+ $ this ->assertEquals ($ decoded ->message , 'abc ' );
86
+ }
87
+
78
88
public function testValidTokenWithNbf ()
79
89
{
80
90
$ payload = array (
@@ -117,7 +127,7 @@ public function testKIDChooser()
117
127
$ this ->assertEquals ($ decoded , 'abc ' );
118
128
}
119
129
120
- public function testNoneToken ()
130
+ public function testNoneAlgorithm ()
121
131
{
122
132
$ msg = JWT ::encode ('abc ' , 'my_key ' );
123
133
$ this ->setExpectedException ('DomainException ' );
@@ -130,4 +140,11 @@ public function testIncorrectAlgorithm()
130
140
$ this ->setExpectedException ('DomainException ' );
131
141
JWT ::decode ($ msg , 'my_key ' , array ('RS256 ' ));
132
142
}
143
+
144
+ public function testMissingAlgorithm ()
145
+ {
146
+ $ msg = JWT ::encode ('abc ' , 'my_key ' );
147
+ $ this ->setExpectedException ('DomainException ' );
148
+ JWT ::decode ($ msg , 'my_key ' );
149
+ }
133
150
}
0 commit comments