summaryrefslogtreecommitdiffstats
path: root/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php')
-rw-r--r--Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
index 0503054..0a78ee8 100644
--- a/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
@@ -25,14 +25,14 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider();
$this->assertTrue($provider->supports($this->getSupportedToken()));
- $this->assertFalse($provider->supports($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')));
+ $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
}
public function testAuthenticateWhenTokenIsNotSupported()
{
$provider = $this->getProvider();
- $this->assertNull($provider->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')));
+ $this->assertNull($provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()));
}
/**
@@ -82,7 +82,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
*/
public function testAuthenticateWhenPreChecksFails()
{
- $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
+ $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$userChecker->expects($this->once())
->method('checkPreAuth')
->will($this->throwException(new CredentialsExpiredException()))
@@ -91,7 +91,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider($userChecker);
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->returnValue($this->getMock('Symfony\Component\Security\Core\User\UserInterface')))
+ ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()))
;
$provider->authenticate($this->getSupportedToken());
@@ -102,7 +102,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
*/
public function testAuthenticateWhenPostChecksFails()
{
- $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
+ $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
$userChecker->expects($this->once())
->method('checkPostAuth')
->will($this->throwException(new AccountExpiredException()))
@@ -111,7 +111,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider($userChecker);
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->returnValue($this->getMock('Symfony\Component\Security\Core\User\UserInterface')))
+ ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()))
;
$provider->authenticate($this->getSupportedToken());
@@ -126,7 +126,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider();
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->returnValue($this->getMock('Symfony\Component\Security\Core\User\UserInterface')))
+ ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()))
;
$provider->expects($this->once())
->method('checkAuthentication')
@@ -145,7 +145,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider(false, false);
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->returnValue($this->getMock('Symfony\Component\Security\Core\User\UserInterface')))
+ ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()))
;
$provider->expects($this->once())
->method('checkAuthentication')
@@ -157,7 +157,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
public function testAuthenticate()
{
- $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
+ $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$user->expects($this->once())
->method('getRoles')
->will($this->returnValue(array('ROLE_FOO')))
@@ -191,7 +191,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
public function testAuthenticateWithPreservingRoleSwitchUserRole()
{
- $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
+ $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
$user->expects($this->once())
->method('getRoles')
->will($this->returnValue(array('ROLE_FOO')))
@@ -209,7 +209,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('foo'))
;
- $switchUserRole = new SwitchUserRole('foo', $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
+ $switchUserRole = new SwitchUserRole('foo', $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
$token->expects($this->once())
->method('getRoles')
->will($this->returnValue(array($switchUserRole)))
@@ -227,7 +227,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
protected function getSupportedToken()
{
- $mock = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', array('getCredentials', 'getProviderKey', 'getRoles'), array(), '', false);
+ $mock = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken')->setMethods(array('getCredentials', 'getProviderKey', 'getRoles'))->disableOriginalConstructor()->getMock();
$mock
->expects($this->any())
->method('getProviderKey')
@@ -242,7 +242,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
protected function getProvider($userChecker = false, $hide = true)
{
if (false === $userChecker) {
- $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
+ $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock();
}
return $this->getMockForAbstractClass('Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider', array($userChecker, 'key', $hide));