File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,29 @@ public function testDefaultConfiguration(): void
3232 $ this ->assertSame ('PHPSESSID=v3absd19o9pi6cjvhb5pkmsfo9; path=/; Secure; HttpOnly; SameSite=Lax; ' , $ cookie );
3333 $ this ->assertSame ('' , (string )$ response ->getBody ());
3434 }
35+
36+ /**
37+ * Test with own settings.
38+ */
39+ public function testDefaultConfigurationWithOwnSettings (): void
40+ {
41+ $ settings = [
42+ 'start_session ' => true ,
43+ 'same_site ' => 'Strict ' ,
44+ 'http_only ' => false ,
45+ ];
46+
47+ $ configuration = new SameSiteCookieConfiguration ($ settings );
48+
49+ session_id ('v3absd19o9pi6cjvhb5pkmsfo9 ' );
50+
51+ $ response = $ this ->runQueue ([
52+ new SameSiteSessionMiddleware (),
53+ new SameSiteCookieMiddleware ($ configuration ),
54+ ]);
55+
56+ $ cookie = $ response ->getHeaderLine ('Set-Cookie ' );
57+ $ this ->assertSame ('PHPSESSID=v3absd19o9pi6cjvhb5pkmsfo9; path=/; Secure; SameSite=Strict; ' , $ cookie );
58+ $ this ->assertSame ('' , (string )$ response ->getBody ());
59+ }
3560}
You can’t perform that action at this time.
0 commit comments