diff options
Diffstat (limited to 'Http/Tests/Authentication')
3 files changed, 19 insertions, 19 deletions
diff --git a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php index c97ee69..cb5fb51 100644 --- a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php +++ b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php @@ -27,14 +27,14 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas protected function setUp() { - $this->httpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); - $this->httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils'); - $this->logger = $this->getMock('Psr\Log\LoggerInterface'); + $this->httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $this->httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(); + $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $this->session = $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface'); - $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $this->session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); + $this->request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); $this->request->expects($this->any())->method('getSession')->will($this->returnValue($this->session)); - $this->exception = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException', array('getMessage')); + $this->exception = $this->getMockBuilder('Symfony\Component\Security\Core\Exception\AuthenticationException')->setMethods(array('getMessage'))->getMock(); } public function testForward() @@ -181,8 +181,8 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas private function getRequest() { - $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); - $request->attributes = $this->getMock('Symfony\Component\HttpFoundation\ParameterBag'); + $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); + $request->attributes = $this->getMockBuilder('Symfony\Component\HttpFoundation\ParameterBag')->getMock(); return $request; } diff --git a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php index 5372993..8b937c5 100644 --- a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php +++ b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php @@ -24,10 +24,10 @@ class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCas protected function setUp() { - $this->httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils'); - $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request'); - $this->request->headers = $this->getMock('Symfony\Component\HttpFoundation\HeaderBag'); - $this->token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $this->httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(); + $this->request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); + $this->request->headers = $this->getMockBuilder('Symfony\Component\HttpFoundation\HeaderBag')->getMock(); + $this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); } public function testRequestIsRedirected() @@ -101,7 +101,7 @@ class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCas public function testTargetPathIsTakenFromTheSession() { - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface'); + $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); $session->expects($this->once()) ->method('get')->with('_security.admin.target_path') ->will($this->returnValue('/admin/dashboard')); diff --git a/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php index 8a31886..330b21a 100644 --- a/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php +++ b/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php @@ -34,11 +34,11 @@ class SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->successHandler = $this->getMock('Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface'); - $this->failureHandler = $this->getMock('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface'); + $this->successHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface')->getMock(); + $this->failureHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface')->getMock(); - $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request'); - $this->token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $this->request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); + $this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); // No methods are invoked on the exception; we just assert on its class $this->authenticationException = new AuthenticationException(); @@ -47,7 +47,7 @@ class SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler() { - $authenticator = $this->getMock('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); $this->successHandler->expects($this->once()) ->method('onAuthenticationSuccess') @@ -117,7 +117,7 @@ class SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase public function testOnAuthenticationFailureFallsBackToDefaultHandlerIfSimpleIsNotAFailureHandler() { - $authenticator = $this->getMock('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface'); + $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); $this->failureHandler->expects($this->once()) ->method('onAuthenticationFailure') |