-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let failedBasicResponse throw an exception
- Loading branch information
1 parent
6b692b3
commit 37fb414
Showing
2 changed files
with
9 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,10 @@ public function testBasicReturnsNullWhenAlreadyLoggedIn() | |
$guard->basic('email'); | ||
} | ||
|
||
/** | ||
* @expectedException \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException | ||
* @expectedExceptionMessage | ||
*/ | ||
public function testBasicReturnsResponseOnFailure() | ||
{ | ||
list($session, $provider, $request, $cookie) = $this->getMocks(); | ||
|
@@ -48,10 +52,7 @@ public function testBasicReturnsResponseOnFailure() | |
$guard->shouldReceive('attempt')->once()->with(['email' => '[email protected]', 'password' => 'secret'])->andReturn(false); | ||
$request = \Symfony\Component\HttpFoundation\Request::create('/', 'GET', [], [], [], ['PHP_AUTH_USER' => '[email protected]', 'PHP_AUTH_PW' => 'secret']); | ||
$guard->setRequest($request); | ||
$response = $guard->basic('email'); | ||
|
||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); | ||
$this->assertEquals(401, $response->getStatusCode()); | ||
$guard->basic('email'); | ||
} | ||
|
||
public function testBasicWithExtraConditions() | ||
|