Skip to content

Commit

Permalink
Merge branch '5.5/rename_auth_assertions' of https://github.com/silee…
Browse files Browse the repository at this point in the history
…nce/laravel-framework into sileence-5.5/rename_auth_assertions
  • Loading branch information
taylorotwell committed Feb 15, 2017
2 parents 0234c57 + 6723898 commit b04dc1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait InteractsWithAuthentication
* @param string|null $driver
* @return $this
*/
public function actingAs(UserContract $user, $driver = null)
public function loginAs(UserContract $user, $driver = null)
{
$this->be($user, $driver);

Expand All @@ -40,7 +40,7 @@ public function be(UserContract $user, $driver = null)
* @param string|null $guard
* @return $this
*/
public function seeIsAuthenticated($guard = null)
public function assertAuthentication($guard = null)
{
$this->assertTrue($this->isAuthenticated($guard), 'The user is not authenticated');

Expand All @@ -53,7 +53,7 @@ public function seeIsAuthenticated($guard = null)
* @param string|null $guard
* @return $this
*/
public function dontSeeIsAuthenticated($guard = null)
public function assertGuest($guard = null)
{
$this->assertFalse($this->isAuthenticated($guard), 'The user is authenticated');

Expand All @@ -78,7 +78,7 @@ protected function isAuthenticated($guard = null)
* @param string|null $guard
* @return $this
*/
public function seeIsAuthenticatedAs($user, $guard = null)
public function assertAuthenticatedAs($user, $guard = null)
{
$expected = $this->app->make('auth')->guard($guard)->user();

Expand All @@ -102,7 +102,7 @@ public function seeIsAuthenticatedAs($user, $guard = null)
* @param string|null $guard
* @return $this
*/
public function seeCredentials(array $credentials, $guard = null)
public function assertCredentials(array $credentials, $guard = null)
{
$this->assertTrue(
$this->hasCredentials($credentials, $guard), 'The given credentials are invalid.'
Expand All @@ -118,7 +118,7 @@ public function seeCredentials(array $credentials, $guard = null)
* @param string|null $guard
* @return $this
*/
public function dontSeeCredentials(array $credentials, $guard = null)
public function assertCredentialsMissing(array $credentials, $guard = null)
{
$this->assertFalse(
$this->hasCredentials($credentials, $guard), 'The given credentials are valid.'
Expand Down
20 changes: 10 additions & 10 deletions tests/Foundation/FoundationAuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ public function tearDown()
m::close();
}

public function testSeeIsAuthenticated()
public function testAssertAuthentication()
{
$this->mockGuard()
->shouldReceive('check')
->once()
->andReturn(true);

$this->seeIsAuthenticated();
$this->assertAuthentication();
}

public function testDontSeeIsAuthenticated()
public function testAssertGuest()
{
$this->mockGuard()
->shouldReceive('check')
->once()
->andReturn(false);

$this->dontSeeIsAuthenticated();
$this->assertGuest();
}

public function testSeeIsAuthenticatedAs()
public function testAssertAuthenticatedAs()
{
$expected = m::mock(Authenticatable::class);
$expected->shouldReceive('getAuthIdentifier')
Expand All @@ -89,7 +89,7 @@ public function testSeeIsAuthenticatedAs()
$user->shouldReceive('getAuthIdentifier')
->andReturn('1');

$this->seeIsAuthenticatedAs($user);
$this->assertAuthenticatedAs($user);
}

protected function setupProvider(array $credentials)
Expand All @@ -112,14 +112,14 @@ protected function setupProvider(array $credentials)
->andReturn($provider);
}

public function testSeeCredentials()
public function testAssertCredentials()
{
$this->setupProvider($this->credentials);

$this->seeCredentials($this->credentials);
$this->assertCredentials($this->credentials);
}

public function testDontSeeCredentials()
public function testAssertCredentialsMissing()
{
$credentials = [
'email' => 'invalid',
Expand All @@ -128,6 +128,6 @@ public function testDontSeeCredentials()

$this->setupProvider($credentials);

$this->dontSeeCredentials($credentials);
$this->assertCredentialsMissing($credentials);
}
}

0 comments on commit b04dc1f

Please sign in to comment.