public function testThrowingExceptionInNonErrorHandlerTriggersNextWithException()
{
$exception = new RuntimeException();
$triggered = null;
$handler = function ($req, $res, $next) use($exception) {
throw $exception;
};
$next = function ($req, $res, $err) use(&$triggered) {
$triggered = $err;
};
$route = new Route('/foo', $handler);
$dispatch = new Dispatch();
$err = null;
$dispatch($route, $err, $this->request->reveal(), $this->response->reveal(), $next);
$this->assertSame($exception, $triggered);
}