@@ -275,9 +275,9 @@ public static function provideValidHeaderCases(): iterable
275
275
// Description => [header name, header value, getHeader(), getHeaderLine()],
276
276
'Basic: value ' => ['Basic ' , 'value ' , ['value ' ], 'value ' ],
277
277
'array value ' => ['Basic ' , ['value ' ], ['value ' ], 'value ' ],
278
- 'two value ' => ['Basic ' , ['value1 ' , 'value2 ' ], ['value1 ' , 'value2 ' ], 'value1,value2 ' ],
278
+ 'two value ' => ['Basic ' , ['value1 ' , 'value2 ' ], ['value1 ' , 'value2 ' ], 'value1, value2 ' ],
279
279
'empty header value ' => ['Bar ' , '' , ['' ], '' ],
280
- 'array value with key ' => ['foo ' , ['foo ' => 'text/plain ' , 'bar ' => 'application/json ' ], ['text/plain ' , 'application/json ' ], 'text/plain,application/json ' ],
280
+ 'array value with key ' => ['foo ' , ['foo ' => 'text/plain ' , 'bar ' => 'application/json ' ], ['text/plain ' , 'application/json ' ], 'text/plain, application/json ' ],
281
281
'Header with int ' => ['HTTP__1 ' , 'test ' , ['test ' ], 'test ' ],
282
282
'Int header ' => [1 , 'test ' , ['test ' ], 'test ' ],
283
283
['key ' , 'allowed key ' , ['allowed key ' ], 'allowed key ' ],
@@ -326,9 +326,18 @@ public function testContainsNotAllowedCharsOnHeaderField($header): void
326
326
$ this ->expectException (InvalidArgumentException::class);
327
327
$ this ->expectExceptionMessage (\sprintf ('[%s] is not a valid HTTP header field name. ' , $ header ));
328
328
329
- $ request = $ this ->classToTest ;
329
+ $ message = $ this ->classToTest ;
330
+
331
+ $ message ->withHeader ($ header , 'value ' );
332
+ }
333
+
334
+ public function testWithAddedHeaderArrayValueAndKeys (): void
335
+ {
336
+ $ message = $ this ->classToTest ->withAddedHeader ('list ' , ['foo ' => 'one ' ]);
337
+ $ message = $ message ->withAddedHeader ('list ' , ['foo ' => 'two ' , 'bar ' => 'three ' ]);
330
338
331
- $ request ->withHeader ($ header , 'value ' );
339
+ $ headerLine = $ message ->getHeaderLine ('list ' );
340
+ self ::assertSame ('one, two, three ' , $ headerLine );
332
341
}
333
342
334
343
public static function provideContainsNotAllowedCharsOnHeaderFieldCases (): iterable
0 commit comments