@@ -30,6 +30,22 @@ public function testConstructorWithHeaders(): void
30
30
$ this ->assertEquals (['value1 ' , 'value2 ' ], $ headers ->get ('X-Custom ' ));
31
31
}
32
32
33
+ /**
34
+ * Tests constructor with comma-separated string values.
35
+ *
36
+ * @return void
37
+ */
38
+ public function testConstructorWithCommaSeparatedString (): void
39
+ {
40
+ $ headers = new HeadersCollection ([
41
+ 'Accept ' => 'application/json, text/html, application/xml ' ,
42
+ 'Cache-Control ' => 'no-cache, no-store ' ,
43
+ ]);
44
+
45
+ $ this ->assertEquals (['application/json ' , 'text/html ' , 'application/xml ' ], $ headers ->get ('Accept ' ));
46
+ $ this ->assertEquals (['no-cache ' , 'no-store ' ], $ headers ->get ('Cache-Control ' ));
47
+ }
48
+
33
49
/**
34
50
* Tests case-insensitive header access.
35
51
*
@@ -126,4 +142,17 @@ public function testWithHeaderImmutability(): void
126
142
$ this ->assertEquals (['text/html ' ], $ new ->get ('Accept ' ));
127
143
$ this ->assertEquals (['application/json ' ], $ original ->get ('Content-Type ' ));
128
144
}
145
+
146
+ /**
147
+ * Tests withHeader with comma-separated string.
148
+ *
149
+ * @return void
150
+ */
151
+ public function testWithHeaderCommaSeparatedString (): void
152
+ {
153
+ $ headers = new HeadersCollection ();
154
+ $ new = $ headers ->withHeader ('Accept ' , 'application/json, text/html, application/xml ' );
155
+
156
+ $ this ->assertEquals (['application/json ' , 'text/html ' , 'application/xml ' ], $ new ->get ('Accept ' ));
157
+ }
129
158
}
0 commit comments