DefaultLogoutSuccessHandlerTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Http\Tests\Logout;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler;
  14. class DefaultLogoutSuccessHandlerTest extends TestCase
  15. {
  16. public function testLogout()
  17. {
  18. $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
  19. $response = new Response();
  20. $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock();
  21. $httpUtils->expects($this->once())
  22. ->method('createRedirectResponse')
  23. ->with($request, '/dashboard')
  24. ->will($this->returnValue($response));
  25. $handler = new DefaultLogoutSuccessHandler($httpUtils, '/dashboard');
  26. $result = $handler->onLogoutSuccess($request);
  27. $this->assertSame($response, $result);
  28. }
  29. }