@@ 121-141 (lines=21) @@ | ||
118 | /** |
|
119 | * testCreateClaimWithMalformedException method |
|
120 | */ |
|
121 | public function testCreateClaimWithMalformedException() |
|
122 | { |
|
123 | $now = Carbon::now()->timestamp; |
|
124 | ||
125 | Config::shouldReceive('get') |
|
126 | ->once() |
|
127 | ->with('jwt.leeway') |
|
128 | ->andReturn(0); |
|
129 | ||
130 | $this->setExpectedException(\WWON\JwtGuard\Exceptions\MalformedException::class); |
|
131 | ||
132 | $claim = new Claim([ |
|
133 | 'sub' => 1, |
|
134 | 'aud' => 'User', |
|
135 | 'iss' => 'http://www.test.com', |
|
136 | 'iat' => $now, |
|
137 | 'exp' => $now - 6000, |
|
138 | 'nat' => $now - 6000, |
|
139 | 'jti' => 'asdjhasiudhasud' |
|
140 | ]); |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * testCreateClaimWithInaccessibleException method |
|
@@ 146-168 (lines=23) @@ | ||
143 | /** |
|
144 | * testCreateClaimWithInaccessibleException method |
|
145 | */ |
|
146 | public function testCreateClaimWithInaccessibleException() |
|
147 | { |
|
148 | $now = Carbon::now()->timestamp; |
|
149 | ||
150 | Config::shouldReceive('get') |
|
151 | ->once() |
|
152 | ->with('jwt.leeway') |
|
153 | ->andReturn(0); |
|
154 | ||
155 | $this->setExpectedException(\WWON\JwtGuard\Exceptions\InaccessibleException::class); |
|
156 | ||
157 | $claim = new Claim([ |
|
158 | 'sub' => 1, |
|
159 | 'aud' => 'User', |
|
160 | 'iss' => 'http://www.test.com', |
|
161 | 'iat' => $now - 6000, |
|
162 | 'exp' => $now + 6000, |
|
163 | 'nat' => $now - 10, |
|
164 | 'jti' => 'asdjhasiudhasud' |
|
165 | ]); |
|
166 | ||
167 | $claim->validateAccessible(); |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * testCreateClaimWithTokenExpiredException method |
|
@@ 173-193 (lines=21) @@ | ||
170 | /** |
|
171 | * testCreateClaimWithTokenExpiredException method |
|
172 | */ |
|
173 | public function testCreateClaimWithTokenExpiredException() |
|
174 | { |
|
175 | $now = Carbon::now()->timestamp; |
|
176 | ||
177 | Config::shouldReceive('get') |
|
178 | ->once() |
|
179 | ->with('jwt.leeway') |
|
180 | ->andReturn(0); |
|
181 | ||
182 | $this->setExpectedException(\WWON\JwtGuard\Exceptions\TokenExpiredException::class); |
|
183 | ||
184 | $claim = new Claim([ |
|
185 | 'sub' => 1, |
|
186 | 'aud' => 'User', |
|
187 | 'iss' => 'http://www.test.com', |
|
188 | 'iat' => $now - 6000, |
|
189 | 'exp' => $now - 1000, |
|
190 | 'nat' => $now - 1000, |
|
191 | 'jti' => 'asdjhasiudhasud' |
|
192 | ]); |
|
193 | } |
|
194 | ||
195 | /** |
|
196 | * testCreateClaimWithNoAudienceAndSubject method |