diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2015-05-18 09:14:21 -0400 |
---|---|---|
committer | Ryan Weaver <ryan@thatsquality.com> | 2015-09-20 19:24:21 -0400 |
commit | 182111856105a1f080bcee931e7fe0af40e55fec (patch) | |
tree | a2008b53a5bbb81fd0115c46dfa64aefdeb19135 /Guard/Tests/Provider/GuardAuthenticationProviderTest.php | |
parent | dd9cccbeed41777f2e0c30d990a47737e8701cc7 (diff) | |
download | symfony-security-182111856105a1f080bcee931e7fe0af40e55fec.zip symfony-security-182111856105a1f080bcee931e7fe0af40e55fec.tar.gz symfony-security-182111856105a1f080bcee931e7fe0af40e55fec.tar.bz2 |
Splitting the getting of the user and checking credentials into two steps
This looks like a subjective change (one more method, but the method implementations are
simpler), but it wasn't. The problem was that the UserChecker checkPreAuth should happen
*after* we get the user, but *before* the credentials are checked, and that wasn't possible
before this change. Now it is.
Diffstat (limited to 'Guard/Tests/Provider/GuardAuthenticationProviderTest.php')
-rw-r--r-- | Guard/Tests/Provider/GuardAuthenticationProviderTest.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/Guard/Tests/Provider/GuardAuthenticationProviderTest.php index 99e9b5d..24c946d 100644 --- a/Guard/Tests/Provider/GuardAuthenticationProviderTest.php +++ b/Guard/Tests/Provider/GuardAuthenticationProviderTest.php @@ -43,21 +43,25 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase 'username' => '_weaverryan_test_user', 'password' => 'guard_auth_ftw', ); - $this->preAuthenticationToken->expects($this->once()) + $this->preAuthenticationToken->expects($this->atLeastOnce()) ->method('getCredentials') ->will($this->returnValue($enteredCredentials)); // authenticators A and C are never called $authenticatorA->expects($this->never()) - ->method('authenticate'); + ->method('getUser'); $authenticatorC->expects($this->never()) - ->method('authenticate'); + ->method('getUser'); $mockedUser = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $authenticatorB->expects($this->once()) - ->method('authenticate') + ->method('getUser') ->with($enteredCredentials, $this->userProvider) ->will($this->returnValue($mockedUser)); + // checkCredentials is called + $authenticatorB->expects($this->once()) + ->method('checkCredentials') + ->with($enteredCredentials, $mockedUser); $authedToken = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $authenticatorB->expects($this->once()) ->method('createAuthenticatedToken') |