diff options
author | Jakub Zalas <jakub@zalas.pl> | 2013-05-24 19:40:30 +0100 |
---|---|---|
committer | Jakub Zalas <jakub@zalas.pl> | 2013-05-25 13:04:50 +0100 |
commit | f70732f96bf3568d2db44e69c298f26cecc160cc (patch) | |
tree | 888d367878681f612abdf7e178ac77485bf9cfcf /Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php | |
parent | 3767e4b66ef8b53be3b7bf4275e5ed82e3569d72 (diff) | |
download | symfony-security-f70732f96bf3568d2db44e69c298f26cecc160cc.zip symfony-security-f70732f96bf3568d2db44e69c298f26cecc160cc.tar.gz symfony-security-f70732f96bf3568d2db44e69c298f26cecc160cc.tar.bz2 |
[Security] Added tests for the DefaultLogoutSuccessHandler.
Diffstat (limited to 'Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php')
-rw-r--r-- | Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php b/Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php new file mode 100644 index 0000000..e1b1227 --- /dev/null +++ b/Tests/Http/Logout/DefaultLogoutSuccessHandlerTest.php @@ -0,0 +1,42 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Tests\Http\Logout; + +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler; + +class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase +{ + protected function setUp() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + } + + public function testLogout() + { + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $response = $this->getMock('Symfony\Component\HttpFoundation\Response'); + + $httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils'); + $httpUtils->expects($this->once()) + ->method('createRedirectResponse') + ->with($request, '/dashboard') + ->will($this->returnValue($response)); + + $handler = new DefaultLogoutSuccessHandler($httpUtils, '/dashboard'); + $result = $handler->onLogoutSuccess($request); + + $this->assertSame($response, $result); + } +} |