jeudi 7 juin 2018

$request->all() in laravel returns empty when called from phpunit

I am trying to write phpunit test cases in Laravel, the problem is the functionality works perfectly fine but when I try to access via phpunit the $request->all() always returns empty.

$request->request->add(['testId' => 1]);

This is called using

 $request->all();

This when called in the Laravel application works as expected and gives the data. But when called via terminal using phpunit it always returns empty array. But it returns the data if called as

$request->request->all();

Please let me know how can this be solved. Laravel verison used is Laravel Framework 5.6.24



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire