title: $response->getBody() is empty when testing Slim 3 routes with PHPUnit
body: <p>I use the following method to dispatch a Slim app's route in my PHPUnit tests:</p>
  
  <pre><code>protected function dispatch($path, $method='GET', $data=array())
  {
      // Prepare a mock environment
      $env = Environment::mock(array(
          'REQUEST_URI' =&gt; $path,
          'REQUEST_METHOD' =&gt; $method,
      ));
  
      // Prepare request and response objects
      $uri = Uri::createFromEnvironment($env);
      $headers = Headers::createFromEnvironment($env);
      $cookies = [];
      $serverParams = $env-&gt;all();
      $body = new RequestBody();
  
      // create request, and set params
      $req = new Request($method, $uri, $headers, $cookies, $serverParams, $body);
      if (!empty($data))
          $req = $req-&gt;withParsedBody($data);
  
      $res = new Response();
  
      $this-&gt;headers = $headers;
      $this-&gt;request = $req;
      $this-&gt;response = call_user_func_array($this-&gt;app, array($req, $res));
  }
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>public function testGetProducts()
  {
      $this-&gt;dispatch('/products');
  
      $this-&gt;assertEquals(200, $this-&gt;response-&gt;getStatusCode());
  }
  </code></pre>
  
  <p>However, as much as things like the status code and header are in the response, <code>(string) $response-&gt;getBody()</code> is empty so I cannot check for the presence of elements in the HTML. When I run the same route in the browser, I get the expected HTML output. Also, if I <code>echo $response-&gt;getBody(); exit;</code> and then view the output in the browser, I see HTML body. Is there any reason, with my implementation, I'm not seeing this in the my tests? (in the CLI, so different environment I guess)</p>