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