f3-factory / fatfree-core

Fat-Free Framework core library
GNU General Public License v3.0
206 stars 89 forks source link

Allow mock() to set the _POST arguments for PUT and PATCH mehtods #324

Closed Frolki1-Dev closed 2 years ago

Frolki1-Dev commented 3 years ago

I had a problem in my tests, that PUT and PATCH ignored the arguments that i passed.

With this pull request I fix this, that also on a PUT or PATCH request will pass the arguments in the _POST.

ikkez commented 3 years ago

But isn't payload from PUT (and PATCH?) usually found in BODY var instead of POST?

Frolki1-Dev commented 3 years ago

My fault, sorry. Normal you can fetch the inputs in PHP with php://input. But in the mock it set in the hive with the key BODY.

Now we can decide between:

Here is my code in the Controller: (It's in the __construct method) image