1212namespace Symfony \Component \Security \Http \Tests \Logout ;
1313
1414use PHPUnit \Framework \TestCase ;
15+ use Symfony \Component \HttpFoundation \Cookie ;
1516use Symfony \Component \HttpFoundation \Request ;
1617use Symfony \Component \HttpFoundation \Response ;
1718use Symfony \Component \HttpFoundation \ResponseHeaderBag ;
@@ -25,7 +26,7 @@ public function testLogout()
2526 $ response = new Response ();
2627 $ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )->getMock ();
2728
28- $ handler = new CookieClearingLogoutHandler (['foo ' => ['path ' => '/foo ' , 'domain ' => 'foo.foo ' ], 'foo2 ' => ['path ' => null , 'domain ' => null ]]);
29+ $ handler = new CookieClearingLogoutHandler (['foo ' => ['path ' => '/foo ' , 'domain ' => 'foo.foo ' , ' secure ' => true , ' samesite ' => Cookie:: SAMESITE_STRICT ], 'foo2 ' => ['path ' => null , 'domain ' => null ]]);
2930
3031 $ cookies = $ response ->headers ->getCookies ();
3132 $ this ->assertCount (0 , $ cookies );
@@ -39,12 +40,16 @@ public function testLogout()
3940 $ this ->assertEquals ('foo ' , $ cookie ->getName ());
4041 $ this ->assertEquals ('/foo ' , $ cookie ->getPath ());
4142 $ this ->assertEquals ('foo.foo ' , $ cookie ->getDomain ());
43+ $ this ->assertEquals (Cookie::SAMESITE_STRICT , $ cookie ->getSameSite ());
44+ $ this ->assertTrue ($ cookie ->isSecure ());
4245 $ this ->assertTrue ($ cookie ->isCleared ());
4346
4447 $ cookie = $ cookies ['' ]['/ ' ]['foo2 ' ];
4548 $ this ->assertStringStartsWith ('foo2 ' , $ cookie ->getName ());
4649 $ this ->assertEquals ('/ ' , $ cookie ->getPath ());
4750 $ this ->assertNull ($ cookie ->getDomain ());
51+ $ this ->assertNull ($ cookie ->getSameSite ());
52+ $ this ->assertFalse ($ cookie ->isSecure ());
4853 $ this ->assertTrue ($ cookie ->isCleared ());
4954 }
5055}
0 commit comments