file_put_contents($path, 'my_file'
);
$browser->
request('POST', 'http://example.com/',
['foo' =>
['bar' => 'foo2'
]],
['foo' =>
['file' =>
['tmp_name' =>
$path, 'name' => 'foo'
]]]);
} public function testMultiPartRequestWithNormalFlatArray() { $client =
$this->
createMock(HttpClientInterface::
class);
$this->
expectClientToSendRequestWithFiles($client,
['file1_content', 'file2_content'
]);
$browser =
new HttpBrowser($client);
$browser->
request('POST', 'http://example.com/',
[],
[ 'file1' =>
$this->
getUploadedFile('file1'
),
'file2' =>
$this->
getUploadedFile('file2'
),
]);
} public function testMultiPartRequestWithNormalNestedArray() { $client =
$this->
createMock(HttpClientInterface::
class);
$this->
expectClientToSendRequestWithFiles($client,
['file1_content', 'file2_content'
]);
$browser =
new HttpBrowser($client);
$browser->
request('POST', 'http://example.com/',
[],
[