mercredi 31 octobre 2018

Laravel - Faking route in PHPUnit

I've been writing some tests in PHPUnit (version 7.4.3), but in some files in my project (a Laravel 5.7.12 JSON API) I need to use the route (/users/123/posts/456), but when PHPUnit calls the route, request()->getPathInfo() returns "".

Is there some way to fake this, or fill it with the correct data?

I am calling the route using $this->getJson(route('users.index')); in the test class.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire