@@ -86,7 +86,11 @@ public function testMultiPartRequestWithSingleFile()
86
86
->with ('POST ' , 'http://example.com/ ' , $ this ->callback (function ($ options ) {
87
87
$ this ->assertStringContainsString ('Content-Type: multipart/form-data ' , implode ('' , $ options ['headers ' ]));
88
88
$ 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 );
90
94
91
95
return true ;
92
96
}))
@@ -95,7 +99,7 @@ public function testMultiPartRequestWithSingleFile()
95
99
$ browser = new HttpBrowser ($ client );
96
100
$ path = tempnam (sys_get_temp_dir (), 'http ' );
97
101
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 ' ] ]]);
99
103
}
100
104
101
105
public function testMultiPartRequestWithNormalFlatArray ()
0 commit comments