title: Laravel API Illuminate\Foundation\Testing\TestResponse empty array when expecting single object
body: <p>Why is it that from a unit test in Laravel if I do the following request, decode the json response, it comes back as an empty array: </p>
  
  <pre><code>$response = $this-&gt;get(route('api.inspections.get', [
      "id" =&gt; $inspection-&gt;id
  ]));
  
  $apiInspection = $response-&gt;json(); # Empty array :(
  </code></pre>
  
  <p>Yet doing the most basic get request to that same URL gets me a nice json response.</p>
  
  <pre><code>$inspection = file_get_contents(route('api.inspections.get', [
      "id" =&gt; $inspection-&gt;id
  ]));
  $inspection = json_decode($inspection); # The expected inspection stdClass
  </code></pre>
  
  <p>Thanks</p>
  
  <hr>
  
  <p><strong>Edit: I found why this behaviour was happening.</strong> 
  It appears from the unit tests, Laravels implicit route model binding I was using fails. So although I thought it should be returning a json object (because it did from Postman) it was actually returning null because of what is presumably a bug in Laravel.</p>
  
  <pre><code># So this api controller action works from CURL, Postman etc - but fails from the phpunit tests
  public function getOne(InspectionsModel $inspection) {
      return $inspection;
  }
  </code></pre>
  
  <p>So I had to change this to</p>
  
  <pre><code>public function getOne(Request $request) {
      return InspectionsModel::find($request-&gt;segment(3));
  }
  </code></pre>
  
  <p>So I've wasted an hour on this simple task just because I thought "It clearly works, I can see it in Postman".</p>