@@ -275,9 +275,9 @@ public static function provideValidHeaderCases(): iterable
275275 // Description => [header name, header value, getHeader(), getHeaderLine()],
276276 'Basic: value ' => ['Basic ' , 'value ' , ['value ' ], 'value ' ],
277277 '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 ' ],
279279 '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 ' ],
281281 'Header with int ' => ['HTTP__1 ' , 'test ' , ['test ' ], 'test ' ],
282282 'Int header ' => [1 , 'test ' , ['test ' ], 'test ' ],
283283 ['key ' , 'allowed key ' , ['allowed key ' ], 'allowed key ' ],
@@ -326,9 +326,18 @@ public function testContainsNotAllowedCharsOnHeaderField($header): void
326326 $ this ->expectException (InvalidArgumentException::class);
327327 $ this ->expectExceptionMessage (\sprintf ('[%s] is not a valid HTTP header field name. ' , $ header ));
328328
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 ' ]);
330338
331- $ request ->withHeader ($ header , 'value ' );
339+ $ headerLine = $ message ->getHeaderLine ('list ' );
340+ self ::assertSame ('one, two, three ' , $ headerLine );
332341 }
333342
334343 public static function provideContainsNotAllowedCharsOnHeaderFieldCases (): iterable
0 commit comments