コード例 #1
0
 /**
  * @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);
 }