Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More examples #14

Open
oxodao opened this issue Apr 1, 2022 · 1 comment
Open

More examples #14

oxodao opened this issue Apr 1, 2022 · 1 comment

Comments

@oxodao
Copy link

oxodao commented Apr 1, 2022

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, [], ''));
@adamkelso
Copy link
Member

Hi @oxodao,

I'm sorry for not responding weeks earlier. Life has gotten in the way of working on this project and it's primarily been on the back-burner. For some time I've wanted to update the documentation from being built in VuePress to switch to Jigsaw instead.

I'm glad you found a solution, though.

If you feel up to it, I always welcome Pull Requests. And thanks for using the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants