function testForwardingPassesRequestFromExceptionPayload()
 {
     $request = new Request(array('content' => "bar"));
     $received_request = clone $request;
     $received_request->setHeader('Asar-Internal-Isforwarded', true);
     $e = new ForwardRequest('Foo');
     $e->setPayload(array('request' => $request));
     $this->resource->expects($this->once())->method('handleRequest')->will($this->throwException($e));
     $final_resource = $this->getMock('Asar\\Resource\\ResourceInterface');
     $final_resource->expects($this->once())->method('handleRequest')->with($received_request);
     $this->routerReturnsResource();
     $this->routerReturnsResource(1, $final_resource);
     $this->app->handleRequest($this->request);
 }
 function forwardTo($resource_name)
 {
     $exception = new ForwardRequest($resource_name);
     $exception->setPayload(array('request' => $this->request));
     throw $exception;
 }