diff options
author | Tobias Schultze <webmaster@tubo-world.de> | 2013-10-31 19:07:47 +0100 |
---|---|---|
committer | Tobias Schultze <webmaster@tubo-world.de> | 2013-11-07 14:20:52 +0100 |
commit | eeac1ab19ffa3e7de6ec255c57e3da45843f7326 (patch) | |
tree | 7f6d7642d5efc6a0b01609383ca65d50abe831a6 /Http | |
parent | cfc877a79617db53cfff99456a652d6f7194a2c0 (diff) | |
download | symfony-security-eeac1ab19ffa3e7de6ec255c57e3da45843f7326.zip symfony-security-eeac1ab19ffa3e7de6ec255c57e3da45843f7326.tar.gz symfony-security-eeac1ab19ffa3e7de6ec255c57e3da45843f7326.tar.bz2 |
adjust doctrine dependencies
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Tests/Firewall/LogoutListenerTest.php | 30 | ||||
-rw-r--r-- | Http/composer.json | 5 |
2 files changed, 16 insertions, 19 deletions
diff --git a/Http/Tests/Firewall/LogoutListenerTest.php b/Http/Tests/Firewall/LogoutListenerTest.php index 719b684..c279523 100644 --- a/Http/Tests/Firewall/LogoutListenerTest.php +++ b/Http/Tests/Firewall/LogoutListenerTest.php @@ -37,22 +37,21 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase public function testHandleMatchedPathWithSuccessHandlerAndCsrfValidation() { $successHandler = $this->getSuccessHandler(); - $csrfProvider = $this->getCsrfProvider(); + $tokenManager = $this->getTokenManager(); - list($listener, $context, $httpUtils, $options) = $this->getListener($successHandler, $csrfProvider); + list($listener, $context, $httpUtils, $options) = $this->getListener($successHandler, $tokenManager); list($event, $request) = $this->getGetResponseEvent(); - $request->query->set('_csrf_token', $csrfToken = 'token'); + $request->query->set('_csrf_token', 'token'); $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) ->will($this->returnValue(true)); - $csrfProvider->expects($this->once()) - ->method('isCsrfTokenValid') - ->with('logout', $csrfToken) + $tokenManager->expects($this->once()) + ->method('isTokenValid') ->will($this->returnValue(true)); $successHandler->expects($this->once()) @@ -151,30 +150,29 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase */ public function testCsrfValidationFails() { - $csrfProvider = $this->getCsrfProvider(); + $tokenManager = $this->getTokenManager(); - list($listener, $context, $httpUtils, $options) = $this->getListener(null, $csrfProvider); + list($listener, $context, $httpUtils, $options) = $this->getListener(null, $tokenManager); list($event, $request) = $this->getGetResponseEvent(); - $request->query->set('_csrf_token', $csrfToken = 'token'); + $request->query->set('_csrf_token', 'token'); $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) ->will($this->returnValue(true)); - $csrfProvider->expects($this->once()) - ->method('isCsrfTokenValid') - ->with('logout', $csrfToken) + $tokenManager->expects($this->once()) + ->method('isTokenValid') ->will($this->returnValue(false)); $listener->handle($event); } - private function getCsrfProvider() + private function getTokenManager() { - return $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'); + return $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'); } private function getContext() @@ -209,7 +207,7 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase ->getMock(); } - private function getListener($successHandler = null, $csrfProvider = null) + private function getListener($successHandler = null, $tokenManager = null) { $listener = new LogoutListener( $context = $this->getContext(), @@ -221,7 +219,7 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase 'logout_path' => '/logout', 'target_url' => '/', ), - $csrfProvider + $tokenManager ); return array($listener, $context, $httpUtils, $options); diff --git a/Http/composer.json b/Http/composer.json index 4dfd985..716c443 100644 --- a/Http/composer.json +++ b/Http/composer.json @@ -23,14 +23,13 @@ "symfony/http-kernel": "~2.4" }, "require-dev": { - "symfony/form": "~2.0", "symfony/routing": "~2.2", "symfony/security-csrf": "~2.4", "psr/log": "~1.0" }, "suggest": { - "symfony/security-csrf": "", - "symfony/routing": "" + "symfony/security-csrf": "For using tokens to protect authentication/logout attempts", + "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs" }, "autoload": { "psr-0": { "Symfony\\Component\\Security\\Http\\": "" } |