Skip to content

Commit

Permalink
Rename GuardHelpers::alreadyAuthenticated() to GuardHelpers::hasUser()
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Jun 8, 2018
1 parent 58eca5b commit 6a9d9e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/GuardHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function authenticate()
}

/**
* Determine if the current user is already authenticated without triggering side effects.
* Determine if the guard has the current user without triggering side effects.
*
* @return bool
*/
public function alreadyAuthenticated()
public function hasUser()
{
return ! is_null($this->user);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Auth/AuthGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ public function testAuthenticateThrowsWhenUserIsNull()
$guard->authenticate();
}

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

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

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

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

public function testIsAuthedReturnsTrueWhenUserIsNotNull()
Expand Down

0 comments on commit 6a9d9e3

Please sign in to comment.