radmax's avatar

radmax wrote a comment+100 XP

1mo ago

@halvarado77 You can use fix mentioned in Github Issue or PR that is linked there. Switching to dev version worked for me.

radmax's avatar

radmax wrote a comment+100 XP

2mos ago

@AndrewDV8 If i understand it correctly Pest is using amphp http server, however it seems that it is not able to parse multipart forms alone. It has plugin https://github.com/amphp/http-server-form-parser, that should just do what is needed to populate $_FILES etc.

radmax's avatar

radmax wrote a comment+100 XP

2mos ago

Hello, I’m really enjoying the whole series — Jeffrey is a great instructor.

I’ve run into an issue with browser testing in Pest and I can’t figure out what I’m missing. My environment is Windows, PHP 8.5, NVS with Node.js 22, Xdebug, PHPStorm — everything else works fine.

When running Pest browser tests, the request is empty whenever multipart/form-data is used (basically any form with this content type). If I submit the same form manually in the browser (my local PHP dev server is running via Symfony CLI), everything works as expected and the request is populated correctly.

So the problem happens only in Pest browser tests, not in the real browser.

Has anyone encountered this with Pest browser tests or knows what could cause multipart/form-data requests to be empty in this case?

What am I missing?

Edit: It is Pest bug https://github.com/pestphp/pest/issues/1495

And indeed in Pest browser plugin it is unfortunately unfinished - https://github.com/pestphp/pest-plugin-browser/blob/4.x/src/Drivers/LaravelHttpServer.php#L257

Edit 2: Plugin has PR with fix: https://github.com/pestphp/pest-plugin-browser/pull/200