@@ -110,38 +110,51 @@ public function provideParsesFromSetCookieStringData(): array
110110 [
111111 'lu=Rg3vHJZnehYLjVg7qi3bZjzg; Domain=.example.com; Path=/; Expires=Tue, 15 Jan 2013 21:47:38 GMT; Max-Age=500; Secure; HttpOnly ' ,
112112 SetCookie::create ('lu ' )
113- ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
114- ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
115- ->withMaxAge (500 )
116- ->withPath ('/ ' )
117- ->withDomain ('.example.com ' )
118- ->withSecure (true )
119- ->withHttpOnly (true ),
113+ ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
114+ ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
115+ ->withMaxAge (500 )
116+ ->withPath ('/ ' )
117+ ->withDomain ('.example.com ' )
118+ ->withSecure (true )
119+ ->withHttpOnly (true ),
120120 ],
121121 [
122122 'lu=Rg3vHJZnehYLjVg7qi3bZjzg; Domain=.example.com; Path=/; Expires=Tue, 15 Jan 2013 21:47:38 GMT; Max-Age=500; Secure; HttpOnly; SameSite=Strict ' ,
123123 SetCookie::create ('lu ' )
124- ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
125- ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
126- ->withMaxAge (500 )
127- ->withPath ('/ ' )
128- ->withDomain ('.example.com ' )
129- ->withSecure (true )
130- ->withHttpOnly (true )
131- ->withSameSite (SameSite::strict ()),
124+ ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
125+ ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
126+ ->withMaxAge (500 )
127+ ->withPath ('/ ' )
128+ ->withDomain ('.example.com ' )
129+ ->withSecure (true )
130+ ->withHttpOnly (true )
131+ ->withSameSite (SameSite::strict ()),
132132 ],
133133 [
134134 'lu=Rg3vHJZnehYLjVg7qi3bZjzg; Domain=.example.com; Path=/; Expires=Tue, 15 Jan 2013 21:47:38 GMT; Max-Age=500; Secure; HttpOnly; SameSite=Lax ' ,
135135 SetCookie::create ('lu ' )
136- ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
137- ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
138- ->withMaxAge (500 )
139- ->withPath ('/ ' )
140- ->withDomain ('.example.com ' )
141- ->withSecure (true )
142- ->withHttpOnly (true )
143- ->withSameSite (SameSite::lax ()),
136+ ->withValue ('Rg3vHJZnehYLjVg7qi3bZjzg ' )
137+ ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
138+ ->withMaxAge (500 )
139+ ->withPath ('/ ' )
140+ ->withDomain ('.example.com ' )
141+ ->withSecure (true )
142+ ->withHttpOnly (true )
143+ ->withSameSite (SameSite::lax ()),
144144 ],
145+ [
146+ 'lu=d2ioU4.4KDUjjnCGNut4; Domain=.example.com; Path=/; Expires=Tue, 15 Jan 2013 21:47:38 GMT; Max-Age=500; Secure; HttpOnly; SameSite=Lax; Partitioned ' ,
147+ SetCookie::create ('lu ' )
148+ ->withValue ('d2ioU4.4KDUjjnCGNut4 ' )
149+ ->withExpires (new DateTime ('Tue, 15-Jan-2013 21:47:38 GMT ' ))
150+ ->withMaxAge (500 )
151+ ->withPath ('/ ' )
152+ ->withDomain ('.example.com ' )
153+ ->withSecure (true )
154+ ->withHttpOnly (true )
155+ ->withSameSite (SameSite::lax ())
156+ ->withPartitioned ()
157+ ]
145158 ];
146159 }
147160
@@ -171,6 +184,24 @@ public function it_creates_long_living_cookies(): void
171184 self ::assertGreaterThan ($ fourYearsFromNow , $ setCookie ->getExpires ());
172185 }
173186
187+ /**
188+ * @test
189+ */
190+ public function it_creates_partitioned_cookies (): void
191+ {
192+ $ setCookie = SetCookie::create ('chips_cookie ' )->withPartitioned ();
193+ self ::assertEquals (true , $ setCookie ->getPartitioned ());
194+ }
195+
196+ /**
197+ * @test
198+ */
199+ public function it_does_not_set_partitioned_cookies_by_default (): void
200+ {
201+ $ setCookie = SetCookie::create ('non_chips_cookie ' );
202+ self ::assertEquals (false , $ setCookie ->getPartitioned ());
203+ }
204+
174205 /** @test */
175206 public function SameSite_modifier_can_be_added_and_removed (): void
176207 {
0 commit comments