I figured out this is kind of the result of the package I was using for Fractal. Seems a lot of fractal abstractions have this problem actually, see more information here:
Json test helper not acknowledging URL params
Hey guys,
I'm currently working with Fractal to build an API in Laravel 5.3. Because of Fractal, I have URLs like so:
/users?include=comments
Which would respond with a list of users with their respective comments. Everything works fine when I test the API endpoints directly in Postman or in the browser, however when I try to write an automated test that hits a URL with one of those parameters, the response doesn't include the relationship. Like so:
$this->json('GET', "users/{$user->id}?include=comments");
If I dump-and-die the response of that, it doesn't include the users comments. But again, if I manually test with Postman, it does work correctly. I've also tried an alternative syntax like so:
$this->json('GET', "users/{$user->id}", ['include' => 'comments']);
However, it still doesn't work. Does anyone know how to get the JSON helper to work correctly in this situation?
Please or to participate in this conversation.