* * By default, any parameter in the :routePattern has the requirement '[a-z0-9-]+' except :page and :id * which have '\d+' by default. * * Finally, you have to return the collection related to a subdomain: * * return array( * :subdomain => $routes, * [...] * ); * * As you see, every RouteCollection (or module) is related directly with a subdomain. This ables you to * create an admin module, for example: * * $blog = new RouteCollection('blog'); * // ... * * $admin = new RouteCollection('admin'); * // ... * * return array( * 'www' => $blog, * 'admin' => $admin * ); * * Now if you access towards the www subdomain the active module will be 'blog', otherwise in the admin * subdomain the 'admin' module will be active. */ $routes = new RouteCollection(); $routes->match('root', '/', 'index#index'); return array('www' => $routes);
public function testMatchSupportsMultipleMethods() { $_SERVER['REQUEST_METHOD'] = 'GET'; $routes = new RouteCollection(); $expected = ['here' => '\\there']; $routes->match(['get', 'post'], 'here', 'there'); $this->assertEquals($expected, $routes->getRoutes()); $_SERVER['REQUEST_METHOD'] = 'POST'; $routes = new RouteCollection(); $routes->match(['get', 'post'], 'here', 'there'); $this->assertEquals($expected, $routes->getRoutes()); }