SessionLogoutHandlerTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.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\Tests\Component\Security\Http\Logout;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Security\Http\Logout\SessionLogoutHandler;
  13. class SessionLogoutHandlerTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testLogout()
  16. {
  17. $handler = new SessionLogoutHandler();
  18. $request = $this->getMock('Symfony\Component\HttpFoundation\Request');
  19. $response = new Response();
  20. $session = $this->getMock('Symfony\Component\HttpFoundation\Session', array(), array(), '', false);
  21. $request
  22. ->expects($this->once())
  23. ->method('getSession')
  24. ->will($this->returnValue($session))
  25. ;
  26. $session
  27. ->expects($this->once())
  28. ->method('invalidate')
  29. ;
  30. $handler->logout($request, $response, $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
  31. }
  32. }