Skip to content

Commit

Permalink
Make SessionGuard Macroable with test (#18796)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio authored and taylorotwell committed Apr 13, 2017
1 parent a73aede commit 85097f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use RuntimeException;
use Illuminate\Support\Str;
use Illuminate\Http\Response;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Session\Session;
use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Contracts\Events\Dispatcher;
Expand All @@ -16,7 +17,7 @@

class SessionGuard implements StatefulGuard, SupportsBasicAuth
{
use GuardHelpers;
use GuardHelpers, Macroable;

/**
* The name of the Guard. Typically "session".
Expand Down
13 changes: 13 additions & 0 deletions tests/Auth/AuthGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ public function testLoginStoresIdentifierInSession()
$mock->login($user);
}

public function testSessionGuardIsMacroable()
{
$guard = $this->getGuard();

$guard->macro('foo', function () {
return 'bar';
});

$this->assertEquals(
'bar', $guard->foo()
);
}

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

0 comments on commit 85097f6

Please sign in to comment.