@@ -86,7 +86,11 @@ public function testMultiPartRequestWithSingleFile()
8686 ->with ('POST ' , 'http://example.com/ ' , $ this ->callback (function ($ options ) {
8787 $ this ->assertStringContainsString ('Content-Type: multipart/form-data ' , implode ('' , $ options ['headers ' ]));
8888 $ this ->assertInstanceOf (\Generator::class, $ options ['body ' ]);
89- $ this ->assertStringContainsString ('my_file ' , implode ('' , iterator_to_array ($ options ['body ' ])));
89+ $ values = implode ('' , iterator_to_array ($ options ['body ' ], false ));
90+ $ this ->assertStringContainsString ('name="foo[file]" ' , $ values );
91+ $ this ->assertStringContainsString ('my_file ' , $ values );
92+ $ this ->assertStringContainsString ('name="foo[bar]" ' , $ values );
93+ $ this ->assertStringContainsString ('foo2 ' , $ values );
9094
9195 return true ;
9296 }))
@@ -95,7 +99,7 @@ public function testMultiPartRequestWithSingleFile()
9599 $ browser = new HttpBrowser ($ client );
96100 $ path = tempnam (sys_get_temp_dir (), 'http ' );
97101 file_put_contents ($ path , 'my_file ' );
98- $ browser ->request ('POST ' , 'http://example.com/ ' , [] , ['file ' => ['tmp_name ' => $ path , 'name ' => 'foo ' ]]);
102+ $ browser ->request ('POST ' , 'http://example.com/ ' , [' foo ' => [ ' bar ' => ' foo2 ' ]] , ['foo ' => [ ' file ' => ['tmp_name ' => $ path , 'name ' => 'foo ' ] ]]);
99103 }
100104
101105 public function testMultiPartRequestWithNormalFlatArray ()
0 commit comments