I don't know if it is intended or not. But when I use a Reponse Code 204 in my Controller I get "Invalid JSON was returned from the route" in PHPunit.
But if I change the Response Code to 201, everything works fine... Why?
protected function output($title, $status = 201)
{
return response([
'title' => $title,
'offers' => $this->popular,
], $status);
}
$this->output('Empty', 204); //Here is the error
In my test
/** @test */
public function popular_can_fetch_food_lists() {
$result = $this->json('post', route('popular', [
'type' => $this->food->type,
'id' => $this->food->id
]))->json();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire