Laravel testing, get JSON content
Proper way to get the content is:
$content = $this->get('/v1/users/1')->decodeResponseJson();
Currently in 5.3 this is working...
$content = $this->get('/v1/users/1')->response->getContent()
;
It does break the chain, however since response
returns the response and not the test runner. So, you should make your chainable assertions before fetching the response, like so...
$content = $this->get('/v1/users/1')->seeStatusCode(200)->response->getContent()
;