Skip to content

Commit

Permalink
Add test for SessionGuard::onceUsingId() (#13408)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlakoff authored and taylorotwell committed May 4, 2016
1 parent 6900919 commit a6ddacb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Auth/AuthGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ public function testLoginUsingIdFailure()
$this->assertFalse($guard->loginUsingId(11));
}

public function testOnceUsingIdSetsUser()
{
list($session, $provider, $request, $cookie) = $this->getMocks();
$guard = m::mock('Illuminate\Auth\SessionGuard', ['default', $provider, $session])->makePartial();

$user = m::mock('Illuminate\Contracts\Auth\Authenticatable');
$guard->getProvider()->shouldReceive('retrieveById')->once()->with(10)->andReturn($user);
$guard->shouldReceive('setUser')->once()->with($user);

$this->assertTrue($guard->onceUsingId(10));
}

public function testOnceUsingIdFailure()
{
list($session, $provider, $request, $cookie) = $this->getMocks();
Expand Down

0 comments on commit a6ddacb

Please sign in to comment.