diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 16:53:49 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 16:53:49 +0100 |
commit | a57c25800dcd39387a9a831ef8f436a6bebb8e72 (patch) | |
tree | 536a2ddb082b1cd251fdc04ff8d9e5700593f805 /Core/Tests/Authentication/AuthenticationProviderManagerTest.php | |
parent | 05b01b879902a75c64b610a28d1f0dc0bee58c91 (diff) | |
parent | 674b38ff1ae98e993fd18e599120ead43705c4bc (diff) | |
download | symfony-security-a57c25800dcd39387a9a831ef8f436a6bebb8e72.zip symfony-security-a57c25800dcd39387a9a831ef8f436a6bebb8e72.tar.gz symfony-security-a57c25800dcd39387a9a831ef8f436a6bebb8e72.tar.bz2 |
Merge branch '2.8' into 3.1
* 2.8:
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 'Core/Tests/Authentication/AuthenticationProviderManagerTest.php')
-rw-r--r-- | Core/Tests/Authentication/AuthenticationProviderManagerTest.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/Core/Tests/Authentication/AuthenticationProviderManagerTest.php index cc8b7c0..274992e 100644 --- a/Core/Tests/Authentication/AuthenticationProviderManagerTest.php +++ b/Core/Tests/Authentication/AuthenticationProviderManagerTest.php @@ -44,7 +44,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase )); try { - $manager->authenticate($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->fail(); } catch (ProviderNotFoundException $e) { $this->assertSame($token, $e->getToken()); @@ -58,7 +58,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase )); try { - $manager->authenticate($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->fail(); } catch (AccountStatusException $e) { $this->assertSame($token, $e->getToken()); @@ -72,7 +72,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase )); try { - $manager->authenticate($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $manager->authenticate($token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->fail(); } catch (AuthenticationException $e) { $this->assertSame($token, $e->getToken()); @@ -83,26 +83,26 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase { $manager = new AuthenticationProviderManager(array( $this->getAuthenticationProvider(true, null, 'Symfony\Component\Security\Core\Exception\AuthenticationException'), - $this->getAuthenticationProvider(true, $expected = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')), + $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()), )); - $token = $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->assertSame($expected, $token); } public function testAuthenticateReturnsTokenOfTheFirstMatchingProvider() { - $second = $this->getMock('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface'); + $second = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock(); $second ->expects($this->never()) ->method('supports') ; $manager = new AuthenticationProviderManager(array( - $this->getAuthenticationProvider(true, $expected = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')), + $this->getAuthenticationProvider(true, $expected = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()), $second, )); - $token = $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->assertSame($expected, $token); } @@ -112,20 +112,20 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase $this->getAuthenticationProvider(true, $token = new UsernamePasswordToken('foo', 'bar', 'key')), )); - $token = $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->assertEquals('', $token->getCredentials()); $manager = new AuthenticationProviderManager(array( $this->getAuthenticationProvider(true, $token = new UsernamePasswordToken('foo', 'bar', 'key')), ), false); - $token = $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); + $token = $manager->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $this->assertEquals('bar', $token->getCredentials()); } protected function getAuthenticationProvider($supports, $token = null, $exception = null) { - $provider = $this->getMock('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface'); + $provider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock(); $provider->expects($this->once()) ->method('supports') ->will($this->returnValue($supports)) @@ -139,7 +139,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase } elseif (null !== $exception) { $provider->expects($this->once()) ->method('authenticate') - ->will($this->throwException($this->getMock($exception, null, array(), ''))) + ->will($this->throwException($this->getMockBuilder($exception)->setMethods(null)->getMock())) ; } |