-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi!
I've seen this issue being closed while there are still quite a few places in the docs that do not have examples
#3
Do you plan to add those ?
Particularly, I took quite a while to figure out how to test multi-part forms that contains file, as I was trying to use the withBody method combined with a MultipartStream object.
My final solution here is the following, if anyone have the same needs:
$filepath = dirname(__FILE__) . '/../assets/asset1.jpg';
$this->guzzler
->expects($this->once())
->post('/assets/')
->withHeader('Authorization', 'Bearer ' . $this->fakeToken)
->withForm([
'my_field_1' => 1,
'my_field_2' => 'my_value',
])
->withFile('file', new File(Utils::tryFopen($filepath, 'r')))
->willRespond(new Response(409, [], ''));
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels