@@ 219-231 (lines=13) @@ | ||
216 | $this->assertTrue($this->apiAuth->supportsToken($this->createToken([]), self::PROVIDER_KEY)); |
|
217 | } |
|
218 | ||
219 | public function testOnAuthenticationFailureWithAuthenticationException() |
|
220 | { |
|
221 | $message = 'Bacon ipsum dolor sit amet'; |
|
222 | ||
223 | $response = $this->apiAuth->onAuthenticationFailure( |
|
224 | $this->createRequestMock(), |
|
225 | new AuthenticationException($message) |
|
226 | ); |
|
227 | ||
228 | $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); |
|
229 | $this->assertEquals(json_encode($message), $response->getContent()); |
|
230 | $this->assertEquals(401, $response->getStatusCode()); |
|
231 | } |
|
232 | ||
233 | public function testOnAuthenticationFailureWithBadCredentialsException() |
|
234 | { |
|
@@ 233-245 (lines=13) @@ | ||
230 | $this->assertEquals(401, $response->getStatusCode()); |
|
231 | } |
|
232 | ||
233 | public function testOnAuthenticationFailureWithBadCredentialsException() |
|
234 | { |
|
235 | $message = 'Bacon ipsum dolor sit amet'; |
|
236 | ||
237 | $response = $this->apiAuth->onAuthenticationFailure( |
|
238 | $this->createRequestMock(), |
|
239 | new BadCredentialsException($message) |
|
240 | ); |
|
241 | ||
242 | $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); |
|
243 | $this->assertEquals(json_encode($message), $response->getContent()); |
|
244 | $this->assertEquals(401, $response->getStatusCode()); |
|
245 | } |
|
246 | ||
247 | /** |
|
248 | * @return \Symfony\Component\HttpFoundation\Request |