Skip to content

Commit

Permalink
Ensure user is logged before expecting user instance type. (#21377)
Browse files Browse the repository at this point in the history
* Ensure user is logged.

Check the user is logged before expecting instance type.

* Update InteractsWithAuthentication.php
  • Loading branch information
shulard authored and taylorotwell committed Sep 25, 2017
1 parent 2be59db commit 5218ea6
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public function assertAuthenticatedAs($user, $guard = null)
{
$expected = $this->app->make('auth')->guard($guard)->user();

$this->assertNotNull($expected, 'The current user is not authenticated.');

$this->assertInstanceOf(
get_class($expected), $user,
'The currently authenticated user is not who was expected'
Expand Down

0 comments on commit 5218ea6

Please sign in to comment.