function testGroup3() { $router = new \AuraTempleFramework\Router('hello'); $router->addGroup('guest'); $router->registerRoute('hello', 'HelloRouteAdmin', 'admin'); $this->assertEquals(false, $router->getMethod()); }
function testGetRoutes() { $router = new \AuraTempleFramework\Router('hello/world'); $router->registerRoute('hello', 'HelloRoute'); $router->registerRoute('world', 'WorldRoute'); $routes = $router->getRoutes(); $routes_arr = ['hello' => ['route' => 'hello', 'segments' => ['hello'], 'callback' => 'HelloRoute', 'group' => 'default'], 'world' => ['route' => 'world', 'segments' => ['world'], 'callback' => 'WorldRoute', 'group' => 'default']]; $this->assertEquals($routes_arr, $routes); $this->assertEquals(count($routes_arr), count($routes)); }
function textIncorrectComplexRoute() { $router = new \AuraTempleFramework\Router('user/world'); $router->registerRoute('user/[0-9]*', 'ComplexRoute'); $this->assertNotEquals('ComplexRoute', $router->getMethod()); }
function testMultipleSegments() { $router = new \AuraTempleFramework\Router('hello/world'); $router->registerRoute('hello/world', 'HelloWorldRoute'); $this->assertEquals('HelloWorldRoute', $router->getMethod()); }