SessionLogoutHandlerTest.php 986 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Symfony\Tests\Component\HttpKernel\Security\Logout;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\HttpKernel\Security\Logout\SessionLogoutHandler;
  5. class SessionLogoutHandlerTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function testLogout()
  8. {
  9. $handler = new SessionLogoutHandler();
  10. $request = $this->getMock('Symfony\Component\HttpFoundation\Request');
  11. $response = new Response();
  12. $session = $this->getMock('Symfony\Component\HttpFoundation\Session', array(), array(), '', false);
  13. $request
  14. ->expects($this->once())
  15. ->method('getSession')
  16. ->will($this->returnValue($session))
  17. ;
  18. $session
  19. ->expects($this->once())
  20. ->method('invalidate')
  21. ;
  22. $handler->logout($request, $response, $this->getMock('Symfony\Component\Security\Authentication\Token\TokenInterface'));
  23. }
  24. }