public function testInvokingWithInteropMiddlewareDispatchesIt()
{
$next = $this->prophesize(Next::class);
$next->willImplement(DelegateInterface::class);
$request = $this->prophesize(ServerRequestInterface::class)->reveal();
$response = $this->prophesize(ResponseInterface::class)->reveal();
$middleware = $this->prophesize(ServerMiddlewareInterface::class);
$middleware->process($request, Argument::that([$next, 'reveal']))->willReturn($response);
$route = new Route('/foo', $middleware->reveal());
$dispatch = new Dispatch();
$this->assertSame($response, $dispatch($route, null, $request, $this->response->reveal(), $next->reveal()));
}