/** * @test */ public function adaptResponseShouldConvertInternalErrorResponseToSymfonyResponse() { $iResponse = new InternalResponse(); $iResponse->setContent('tussi'); $iResponse->setStatusCode(404); $iResponse->setHeader('gran', 'oculusso'); $adapter = new SymfonyRendererAdapter(); $response = $adapter->adaptResponse($iResponse); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response); $this->assertTrue($response->headers->has('gran')); $this->assertSame('Not Found', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); }
/** * @param FileObject $file * @param Response $response */ protected function injectContentToResponse(FileObject $file, Response $response) { $response->setContent(function () use($file) { return file_get_contents($file->getRealPath()); }); }