Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 6ad326b

Browse files
committed
Add test to cover exception when using setter to set SameSite directive value
1 parent 10aaf6a commit 6ad326b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/Header/SetCookieTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testSetCookieWithInvalidSameSiteValueThrowException()
7373
{
7474
$this->expectException(InvalidArgumentException::class);
7575

76-
$setCookieHeader = new SetCookie(
76+
new SetCookie(
7777
'myname',
7878
'myvalue',
7979
'Wed, 13-Jan-2021 22:23:01 GMT',
@@ -87,6 +87,24 @@ public function testSetCookieWithInvalidSameSiteValueThrowException()
8787
);
8888
}
8989

90+
public function testSetInvalidSameSiteDirectiveValueViaSetter()
91+
{
92+
$setCookieHeader = new SetCookie(
93+
'myname',
94+
'myvalue',
95+
'Wed, 13-Jan-2021 22:23:01 GMT',
96+
'/accounts',
97+
'docs.foo.com',
98+
true,
99+
true,
100+
99,
101+
9
102+
);
103+
104+
$this->expectException(InvalidArgumentException::class);
105+
$setCookieHeader->setSameSite('InvalidValue');
106+
}
107+
90108
public function testSetCookieFromStringWithQuotedValue()
91109
{
92110
$setCookieHeader = SetCookie::fromString('Set-Cookie: myname="quotedValue"');

0 commit comments

Comments
 (0)