@@ 267-282 (lines=16) @@ | ||
264 | $this->assertTrue($guard->logout()); |
|
265 | } |
|
266 | ||
267 | public function testLogoutWithoutToken() |
|
268 | { |
|
269 | $provider = m::mock(Illuminate\Contracts\Auth\UserProvider::class); |
|
270 | ||
271 | $blacklist = m::mock(Framgia\Jwt\Blacklist::class); |
|
272 | $blacklist->shouldNotReceive('add'); |
|
273 | ||
274 | $signer = m::mock(Framgia\Jwt\Contracts\Signer::class); |
|
275 | ||
276 | $request = Illuminate\Http\Request::create('/'); |
|
277 | $signer->shouldReceive('verify')->once()->andReturn(true); |
|
278 | ||
279 | $guard = new Framgia\Jwt\Guard($provider, $request, $blacklist, $signer); |
|
280 | ||
281 | $this->assertTrue($guard->logout()); |
|
282 | } |
|
283 | ||
284 | public function testLogoutWithInvalidToken() |
|
285 | { |
|
@@ 284-300 (lines=17) @@ | ||
281 | $this->assertTrue($guard->logout()); |
|
282 | } |
|
283 | ||
284 | public function testLogoutWithInvalidToken() |
|
285 | { |
|
286 | $provider = m::mock(Illuminate\Contracts\Auth\UserProvider::class); |
|
287 | ||
288 | $blacklist = m::mock(Framgia\Jwt\Blacklist::class); |
|
289 | $blacklist->shouldNotReceive('add'); |
|
290 | ||
291 | $signer = m::mock(Framgia\Jwt\Contracts\Signer::class); |
|
292 | ||
293 | $request = Illuminate\Http\Request::create('/'); |
|
294 | $request->headers->set('Authorization', 'Bearer BAD_TOKEN'); |
|
295 | $signer->shouldReceive('verify')->once()->andReturn(true); |
|
296 | ||
297 | $guard = new Framgia\Jwt\Guard($provider, $request, $blacklist, $signer); |
|
298 | ||
299 | $this->assertFalse($guard->logout()); |
|
300 | } |
|
301 | } |
|
302 | ||
303 | abstract class UserWithCredentials implements \Illuminate\Contracts\Auth\Authenticatable, \Framgia\Jwt\Contracts\ProvidesCredentials {} |