public function test_url_generator_from_route_name_for_webpack() { $webpack = new WebpackUrlGenerator(); FakeRouter::swap(); $url_generated = $webpack->toRoute('home'); $expected_url = url('') . ':8080/dev/home'; $this->assertEquals($url_generated, $expected_url); }
/** * @covers common\classes\Router::route */ public function test_route() { $_SERVER['REQUEST_URI'] = '/users'; self::assertEquals($this->router->route(), $this->router->users()); $_SERVER['REQUEST_URI'] = '/user/1'; self::assertEquals($this->router->route(), $this->router->user(1)); $_SERVER['REQUEST_URI'] = '/team/dynamo'; self::assertEquals($this->router->route(), FakeRouter::team('dynamo')); $_SERVER['REQUEST_URI'] = '/not_existed_page'; self::assertEquals($this->router->route(), $this->router->not_found()); $router_routes = $this->router->get_routes(); $this->router->set_routes([]); self::assertNull($this->router->route()); $this->router->set_routes($router_routes); }