ClearSiteDataLogoutListener example

class ClearSiteDataLogoutListenerTest extends TestCase
{
    /** * @dataProvider provideClearSiteDataConfig */
    public function testLogout(array $clearSiteDataConfig, string $expectedHeader)
    {
        $response = new Response();
        $event = new LogoutEvent(new Request(), null);
        $event->setResponse($response);

        $listener = new ClearSiteDataLogoutListener($clearSiteDataConfig);

        $headerCountBefore = $response->headers->count();

        $listener->onLogout($event);

        $this->assertEquals(++$headerCountBefore$response->headers->count());

        $this->assertNotNull($response->headers->get('Clear-Site-Data'));
        $this->assertEquals($expectedHeader$response->headers->get('Clear-Site-Data'));
    }

    
Home | Imprint | This part of the site doesn't use cookies.