/** * @param $isInArgs * @param Container $services * @return Router */ private function provideRouter($isInArgs, Container $services) { $router = new Router(new RouteFinder($services)); $router->addRoute(new Route(new RoutePattern($isInArgs ? ':all' : 'REQUEST_URI'), function () { })); $router->find(new Request([], [], [], [], [], ['REQUEST_URI' => 'REQUEST_URI'])); return $router; }
/** * */ public function testGetCurrentRoute() { $request = new RequestMock(); $request->setRequestUri('uri'); $route = new Route(new RoutePattern('uri'), function () { }); $router = new Router(new RouteFinder(new Container())); $router->addRoute($route); $this->assertNull($router->getCurrentRoute()); $router->find($request, new \ArrayObject()); $this->assertSame($route, $router->getCurrentRoute()); }