@@ -94,7 +94,11 @@ public function testMultiPartRequestWithSingleFile()
9494 ->with ('POST ' , 'http://example.com/ ' , $ this ->callback (function ($ options ) {
9595 $ this ->assertStringContainsString ('Content-Type: multipart/form-data ' , implode ('' , $ options ['headers ' ]));
9696 $ this ->assertInstanceOf (\Generator::class, $ options ['body ' ]);
97- $ this ->assertStringContainsString ('my_file ' , implode ('' , iterator_to_array ($ options ['body ' ])));
97+ $ values = implode ('' , iterator_to_array ($ options ['body ' ], false ));
98+ $ this ->assertStringContainsString ('name="foo[file]" ' , $ values );
99+ $ this ->assertStringContainsString ('my_file ' , $ values );
100+ $ this ->assertStringContainsString ('name="foo[bar]" ' , $ values );
101+ $ this ->assertStringContainsString ('foo2 ' , $ values );
98102
99103 return true ;
100104 }))
@@ -103,7 +107,7 @@ public function testMultiPartRequestWithSingleFile()
103107 $ browser = new HttpBrowser ($ client );
104108 $ path = tempnam (sys_get_temp_dir (), 'http ' );
105109 file_put_contents ($ path , 'my_file ' );
106- $ browser ->request ('POST ' , 'http://example.com/ ' , [] , ['file ' => ['tmp_name ' => $ path , 'name ' => 'foo ' ]]);
110+ $ browser ->request ('POST ' , 'http://example.com/ ' , [' foo ' => [ ' bar ' => ' foo2 ' ]] , ['foo ' => [ ' file ' => ['tmp_name ' => $ path , 'name ' => 'foo ' ] ]]);
107111 }
108112
109113 public function testMultiPartRequestWithNormalFlatArray ()
0 commit comments