/**
* @group templated
*/
public function testInvocationWithoutErrorAndResponseSameAsOriginalCanReturnTemplated404Response()
{
$template = $this->getTemplateImplementation();
$template->render('error::404', Argument::type('array'))->willReturn('Templated contents');
$handler = new TemplatedErrorHandler($template->reveal(), 'error::404', 'error::500');
$expected = $this->getResponse($this->getStream());
$stream = $this->getStream();
$stream->getSize()->willReturn(100);
$stream->write('Templated contents')->shouldBeCalled();
$response = $this->getResponse($stream);
$response->getStatusCode()->willReturn(200);
$response->withStatus(404)->willReturn($expected->reveal());
$handler->setOriginalResponse($response->reveal());
$request = $this->getRequest($this->getStream());
$request->getUri()->shouldBeCalled();
$result = $handler($request->reveal(), $response->reveal());
$this->assertSame($expected->reveal(), $result);
}