@@ -138,19 +138,31 @@ Assert::exception(
138138// SameSite=None forces the Secure attribute (otherwise the browser rejects the cookie)
139139$ response = new Http \Response ;
140140$ old = headers_list ();
141- $ response ->setCookie ('test ' , 'value ' , null , sameSite: Http \IResponse::SameSiteNone );
141+ $ response ->setCookie ('test ' , 'value ' , null , sameSite: Http \SameSite::None );
142142$ headers = array_values (array_diff (headers_list (), $ old , ['Set-Cookie: ' ]));
143143Assert::same (['Set-Cookie: test=value; path=/; secure; HttpOnly; SameSite=None ' ], $ headers );
144144
145145
146146// Partitioned (CHIPS) adds the attribute and forces Secure
147147$ response = new Http \Response ;
148148$ old = headers_list ();
149- $ response ->setCookie ('test ' , 'value ' , null , sameSite: Http \IResponse::SameSiteNone , partitioned: true );
149+ $ response ->setCookie ('test ' , 'value ' , null , sameSite: Http \SameSite::None , partitioned: true );
150150$ headers = array_values (array_diff (headers_list (), $ old , ['Set-Cookie: ' ]));
151151Assert::same (['Set-Cookie: test=value; path=/; secure; HttpOnly; SameSite=None; Partitioned ' ], $ headers );
152152
153153
154+ // the SameSite enum and the equivalent string produce the same header
155+ $ response = new Http \Response ;
156+ $ old = headers_list ();
157+ $ response ->setCookie ('test ' , 'a ' , null , sameSite: Http \SameSite::Strict);
158+ $ response ->setCookie ('test ' , 'b ' , null , sameSite: 'Strict ' );
159+ $ headers = array_values (array_diff (headers_list (), $ old , ['Set-Cookie: ' ]));
160+ Assert::same ([
161+ 'Set-Cookie: test=a; path=/; HttpOnly; SameSite=Strict ' ,
162+ 'Set-Cookie: test=b; path=/; HttpOnly; SameSite=Strict ' ,
163+ ], $ headers );
164+
165+
154166// integer 0 is deprecated, but kept as a session cookie for BC
155167$ response = new Http \Response ;
156168$ old = headers_list ();
0 commit comments