getFinalHandler() public method

Return the final handler to use during run() if the stack is exhausted.
public getFinalHandler ( Psr\Http\Message\ResponseInterface $response = null ) : callable | null
$response Psr\Http\Message\ResponseInterface Response instance with which to seed the FinalHandler; used to determine if the response passed to the handler represents the original or final response state.
return callable | null
 public function testCanInjectFinalHandlerViaConstructor()
 {
     $finalHandler = function ($req, $res, $err = null) {
     };
     $app = new Application($this->router->reveal(), null, $finalHandler);
     $test = $app->getFinalHandler();
     $this->assertSame($finalHandler, $test);
 }
 public function testFinalHandlerCreatedAtInvocationIsProvidedResponseInstance()
 {
     $routeResult = RouteResult::fromRouteFailure();
     $this->router->match()->willReturn($routeResult);
     $app = new Application($this->router->reveal());
     $finalResponse = $this->prophesize('Psr\\Http\\Message\\ResponseInterface');
     $app->pipe(function ($req, $res, $next) use($finalResponse) {
         return $finalResponse->reveal();
     });
     $responseStream = $this->prophesize('Psr\\Http\\Message\\StreamInterface');
     $responseStream->getSize()->willReturn(0);
     $request = new Request([], [], 'http://example.com/');
     $response = $this->prophesize('Psr\\Http\\Message\\ResponseInterface');
     $response->getBody()->willReturn($responseStream->reveal());
     $test = $app($request, $response->reveal());
     $finalHandler = $app->getFinalHandler();
     $this->assertInstanceOf('Zend\\Stratigility\\FinalHandler', $finalHandler);
     $r = new ReflectionProperty($finalHandler, 'response');
     $r->setAccessible(true);
     $handlerResponse = $r->getValue($finalHandler);
     $this->assertSame($response->reveal(), $handlerResponse);
 }