diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 17:13:57 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 17:13:57 +0100 |
commit | 9ba5cbed388bbf235d6ba2e2211134ff5514960f (patch) | |
tree | 669494c864e907ed8c1f286dd049c11739b93472 /Guard | |
parent | 3b5625de42114cd121282bdfc4879a28e85d64ec (diff) | |
parent | 7a9b11f3428243d368690b9485098e2d531703e7 (diff) | |
download | symfony-security-9ba5cbed388bbf235d6ba2e2211134ff5514960f.zip symfony-security-9ba5cbed388bbf235d6ba2e2211134ff5514960f.tar.gz symfony-security-9ba5cbed388bbf235d6ba2e2211134ff5514960f.tar.bz2 |
Merge branch '3.2'
* 3.2:
fixed obsolete getMock() usage
fixed obsolete getMock() usage
fixed obsolete getMock() usage
fixed obsolete getMock() usage
[WebProfilerBundle] Display multiple HTTP headers in WDT
do not remove the Twig ExceptionController service
removed obsolete condition
do not try to register incomplete definitions
Diffstat (limited to 'Guard')
-rw-r--r-- | Guard/Tests/Firewall/GuardAuthenticationListenerTest.php | 22 | ||||
-rw-r--r-- | Guard/Tests/GuardAuthenticatorHandlerTest.php | 8 | ||||
-rw-r--r-- | Guard/Tests/Provider/GuardAuthenticationProviderTest.php | 20 |
3 files changed, 25 insertions, 25 deletions
diff --git a/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php index 3224fee..dee7ad1 100644 --- a/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php +++ b/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php @@ -31,8 +31,8 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase public function testHandleSuccess() { - $authenticator = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticateToken = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticateToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $providerKey = 'my_firewall'; $credentials = array('username' => 'weaverryan', 'password' => 'all_your_base'); @@ -81,8 +81,8 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase public function testHandleSuccessStopsAfterResponseIsSet() { - $authenticator1 = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticator2 = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $authenticator1 = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticator2 = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); // mock the first authenticator to fail, and set a Response $authenticator1 @@ -111,8 +111,8 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase public function testHandleSuccessWithRememberMe() { - $authenticator = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticateToken = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticateToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $providerKey = 'my_firewall_with_rememberme'; $authenticator @@ -154,7 +154,7 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase public function testHandleCatchesAuthenticationException() { - $authenticator = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); $providerKey = 'my_firewall2'; $authException = new AuthenticationException('Get outta here crazy user with a bad password!'); @@ -186,8 +186,8 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase public function testReturnNullToSkipAuth() { - $authenticatorA = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticatorB = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $authenticatorA = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticatorB = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); $providerKey = 'my_firewall3'; $authenticatorA @@ -240,8 +240,8 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase ->method('getRequest') ->will($this->returnValue($this->request)); - $this->logger = $this->getMock('Psr\Log\LoggerInterface'); - $this->rememberMeServices = $this->getMock('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface'); + $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $this->rememberMeServices = $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock(); } protected function tearDown() diff --git a/Guard/Tests/GuardAuthenticatorHandlerTest.php b/Guard/Tests/GuardAuthenticatorHandlerTest.php index 6f36702..58a3e17 100644 --- a/Guard/Tests/GuardAuthenticatorHandlerTest.php +++ b/Guard/Tests/GuardAuthenticatorHandlerTest.php @@ -123,11 +123,11 @@ class GuardAuthenticatorHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); - $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $this->token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $this->tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); + $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); + $this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $this->request = new Request(array(), array(), array(), array(), array(), array()); - $this->guardAuthenticator = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $this->guardAuthenticator = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); } protected function tearDown() diff --git a/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/Guard/Tests/Provider/GuardAuthenticationProviderTest.php index bfcf24b..e7e323a 100644 --- a/Guard/Tests/Provider/GuardAuthenticationProviderTest.php +++ b/Guard/Tests/Provider/GuardAuthenticationProviderTest.php @@ -27,9 +27,9 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase { $providerKey = 'my_cool_firewall'; - $authenticatorA = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticatorB = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); - $authenticatorC = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $authenticatorA = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticatorB = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); + $authenticatorC = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); $authenticators = array($authenticatorA, $authenticatorB, $authenticatorC); // called 2 times - for authenticator A and B (stops on B because of match) @@ -52,7 +52,7 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase $authenticatorC->expects($this->never()) ->method('getUser'); - $mockedUser = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); + $mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $authenticatorB->expects($this->once()) ->method('getUser') ->with($enteredCredentials, $this->userProvider) @@ -63,7 +63,7 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->with($enteredCredentials, $mockedUser) // authentication works! ->will($this->returnValue(true)); - $authedToken = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $authedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $authenticatorB->expects($this->once()) ->method('createAuthenticatedToken') ->with($mockedUser, $providerKey) @@ -89,7 +89,7 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase { $providerKey = 'my_uncool_firewall'; - $authenticator = $this->getMock('Symfony\Component\Security\Guard\GuardAuthenticatorInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Guard\GuardAuthenticatorInterface')->getMock(); // make sure the authenticator is used $this->preAuthenticationToken->expects($this->any()) @@ -101,7 +101,7 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->method('getCredentials') ->will($this->returnValue('non-null-value')); - $mockedUser = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); + $mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $authenticator->expects($this->once()) ->method('getUser') ->will($this->returnValue($mockedUser)); @@ -124,7 +124,7 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase // create a token and mark it as NOT authenticated anymore // this mimics what would happen if a user "changed" between request - $mockedUser = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); + $mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $token = new PostAuthenticationGuardToken($mockedUser, $providerKey, array('ROLE_USER')); $token->setAuthenticated(false); @@ -134,8 +134,8 @@ class GuardAuthenticationProviderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface'); - $this->userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface'); + $this->userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); + $this->userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock(); $this->preAuthenticationToken = $this->getMockBuilder('Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken') ->disableOriginalConstructor() ->getMock(); |