@@ -131,6 +131,42 @@ public function testWithAddedHeader()
131
131
$ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('Content-Type ' ));
132
132
}
133
133
134
+ /**
135
+ * Make sure we maintain headers when we add array values.
136
+ */
137
+ public function testWithAddedHeaderArrayValue ()
138
+ {
139
+ if (isset ($ this ->skippedTests [__FUNCTION__ ])) {
140
+ $ this ->markTestSkipped ($ this ->skippedTests [__FUNCTION__ ]);
141
+ }
142
+
143
+ $ message = $ this ->getMessage ()->withAddedHeader ('content-type ' , 'text/html ' );
144
+ $ message = $ message ->withAddedHeader ('content-type ' , ['text/plain ' , 'application/json ' ]);
145
+
146
+ $ headerLine = $ message ->getHeaderLine ('content-type ' );
147
+ $ this ->assertRegExp ('|text/html| ' , $ headerLine );
148
+ $ this ->assertRegExp ('|text/plain| ' , $ headerLine );
149
+ $ this ->assertRegExp ('|application/json| ' , $ headerLine );
150
+ }
151
+
152
+ /**
153
+ * Make sure we maintain headers when we add array values with keys.
154
+ */
155
+ public function testWithAddedHeaderArrayValueAndKeys ()
156
+ {
157
+ if (isset ($ this ->skippedTests [__FUNCTION__ ])) {
158
+ $ this ->markTestSkipped ($ this ->skippedTests [__FUNCTION__ ]);
159
+ }
160
+
161
+ $ message = $ this ->getMessage ()->withAddedHeader ('content-type ' , ['foo ' => 'text/html ' ]);
162
+ $ message = $ message ->withAddedHeader ('content-type ' , ['foo ' => 'text/plain ' , 'bar ' => 'application/json ' ]);
163
+
164
+ $ headerLine = $ message ->getHeaderLine ('content-type ' );
165
+ $ this ->assertRegExp ('|text/html| ' , $ headerLine );
166
+ $ this ->assertRegExp ('|text/plain| ' , $ headerLine );
167
+ $ this ->assertRegExp ('|application/json| ' , $ headerLine );
168
+ }
169
+
134
170
public function testWithoutHeader ()
135
171
{
136
172
if (isset ($ this ->skippedTests [__FUNCTION__ ])) {
0 commit comments