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'
));
} public static function provideClearSiteDataConfig(): iterable
{ yield [['*'
], '"*"'
];
yield [['cache', 'cookies', 'storage', 'executionContexts'
], '"cache", "cookies", "storage", "executionContexts"'
];
}