Skip to content

Commit b6cbcff

Browse files
committed
fix tests
1 parent 1227330 commit b6cbcff

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Tests/EventListener/CookieClearingLogoutListenerTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testLogout()
4343
$this->assertEquals('foo.foo', $cookie->getDomain());
4444
$this->assertEquals(Cookie::SAMESITE_STRICT, $cookie->getSameSite());
4545
$this->assertTrue($cookie->isSecure());
46-
if (method_exists(Cookie::class, 'isPartitioned')) {
46+
if (self::doesResponseHeaderBagClearChipsCookies()) {
4747
$this->assertTrue($cookie->isPartitioned());
4848
}
4949
$this->assertTrue($cookie->isCleared());
@@ -54,9 +54,20 @@ public function testLogout()
5454
$this->assertNull($cookie->getDomain());
5555
$this->assertNull($cookie->getSameSite());
5656
$this->assertFalse($cookie->isSecure());
57-
if (method_exists(Cookie::class, 'isPartitioned')) {
57+
if (self::doesResponseHeaderBagClearChipsCookies()) {
5858
$this->assertFalse($cookie->isPartitioned());
5959
}
6060
$this->assertTrue($cookie->isCleared());
6161
}
62+
63+
/**
64+
* Checks if the patch from https://github.com/symfony/symfony/pull/53703 is available.
65+
*/
66+
private static function doesResponseHeaderBagClearChipsCookies(): bool
67+
{
68+
$bag = new ResponseHeaderBag();
69+
$bag->clearCookie('foo', '/', null, false, true, null, true);
70+
71+
return $bag->getCookies()[0]->isPartitioned();
72+
}
6273
}

0 commit comments

Comments
 (0)