/** * @dataProvider provideRouterData * @testdox A known URL creates a DisplayPageCommand with the related ID */ public function testKnownUrlCreatesDisplayPageCommand($id, $url) { $test = $this; $app = new Application([new RouterMiddleware($this->container), function (ServerRequestInterface $request, ResponseInterface $response, callable $next) use($test, $id) { $attributes = $request->getAttributes(); $command = $attributes['command']; $test->assertInstanceOf(DisplayPageCommand::class, $command); $test->assertEquals($id, $command->id); return $next($request, $response); }]); $server = ['REQUEST_URI' => $url]; $app->run(ServerRequestFactory::fromGlobals($server)); }
/** * Create a request * * @param Container $container The container * * @return ServerRequest */ public function createRequest(Container $container) { return ServerRequestFactory::fromGlobals(); }