/**
  * Ensure that if `outputBuffering` property is set to `false` correct response
  * body is returned by __invoke().
  */
 public function testInvokeWhenDisablingOutputBuffer()
 {
     ob_start();
     $callable = function ($req, $res, $args) {
         echo 'foo';
         return $res->write('bar');
     };
     $route = new Route(['GET'], '/', $callable);
     $route->setOutputBuffering(false);
     $env = Environment::mock();
     $uri = Uri::createFromString('https://example.com:80');
     $headers = new Headers();
     $cookies = [];
     $serverParams = $env->all();
     $body = new Body(fopen('php://temp', 'r+'));
     $request = new Request('GET', $uri, $headers, $cookies, $serverParams, $body);
     $response = new Response();
     $response = $route->__invoke($request, $response);
     $this->assertEquals('bar', (string) $response->getBody());
     $output = ob_get_clean();
     $this->assertEquals('foo', $output);
 }