public function testLogout() { $request = new Request(); $response = new Response(); $token = $this->getMock('Symfony\\Component\\Security\\Authentication\\Token\\TokenInterface'); $handler = new CookieClearingLogoutHandler(array('foo', 'foo2')); $this->assertFalse($response->headers->has('Set-Cookie')); $handler->logout($request, $response, $token); $headers = $response->headers->all(); $cookies = $headers['set-cookie']; $this->assertEquals(2, count($cookies)); $cookie = $cookies[0]; $this->assertStringStartsWith('foo=;', $cookie); $cookie = $cookies[1]; $this->assertStringStartsWith('foo2=;', $cookie); }
public function testLogout() { $request = new Request(); $response = new Response(); $token = $this->getMock('Symfony\\Component\\Security\\Authentication\\Token\\TokenInterface'); $handler = new CookieClearingLogoutHandler(array('foo', 'foo2')); $this->assertFalse($response->headers->hasCookie('foo')); $handler->logout($request, $response, $token); $cookies = $response->headers->getCookies(); $this->assertEquals(2, count($cookies)); $cookie = $cookies['foo']; $this->assertEquals('foo', $cookie->getName()); $this->assertTrue($cookie->isCleared()); $cookie = $cookies['foo2']; $this->assertStringStartsWith('foo2', $cookie->getName()); $this->assertTrue($cookie->isCleared()); }