Skip to content

Commit

Permalink
Add test of Add GuardHelpers::alreadyAuthenticated()
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Jun 8, 2018
1 parent c284bcb commit 58eca5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Auth/AuthGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ public function testAuthenticateThrowsWhenUserIsNull()
$guard->authenticate();
}

public function testAlreadyAuthenticatedReturnsFalseWhenUserIsNotNull()
{
$user = m::mock('Illuminate\Contracts\Auth\Authenticatable');
$guard = $this->getGuard()->setUser($user);

$this->assertTrue($guard->alreadyAuthenticated());
}

public function testAlreadyAuthenticatedReturnsFalseWhenUserIsNull()
{
$guard = $this->getGuard();
$guard->getSession()->shouldNotReceive('get');

$this->assertFalse($guard->alreadyAuthenticated());
}

public function testIsAuthedReturnsTrueWhenUserIsNotNull()
{
$user = m::mock('Illuminate\Contracts\Auth\Authenticatable');
Expand Down

0 comments on commit 58eca5b

Please sign in to comment.