public function testThrowsThrowablesRaisedByCallableMiddlewareWhenRaiseThrowablesFlagIsEnabled($throwable)
{
$middleware = function () use($throwable) {
throw $throwable;
};
$route = new Route('/', $middleware);
$next = $this->prophesize(Next::class);
$next->__invoke(Argument::type(ServerRequestInterface::class), Argument::type(ResponseInterface::class), $throwable)->shouldNotBeCalled();
$dispatch = new Dispatch();
$dispatch->raiseThrowables();
try {
$dispatch($route, null, $this->request->reveal(), $this->response->reveal(), $next->reveal());
$this->fail('Dispatch succeeded and should not have');
} catch (\Throwable $e) {
$this->assertSame($throwable, $e, sprintf('Throwable raised is not the one expected: %s', $e->getMessage()));
} catch (\Exception $e) {
$this->assertSame($throwable, $e, sprintf('Exception raised is not the one expected: %s', $e->getMessage()));
}
}