/** * @param Event $event * @param Application $application * @return mixed */ public function boot(Event $event, Application $application) { // Initializes router $router = new Router(false); $router->setDI($application->getDI()); // default routes if (isset($application->getConfig()->application->defaultRoutes)) { $defaultRoutesPath = $application->getConfig()->application->defaultRoutes; if (file_exists($defaultRoutesPath)) { require $defaultRoutesPath; } } // Modules routes (new Router\Loader())->autoload($application->getModules(), $router); $application->getDI()->setShared('router', $router); }
/** * @expectedException Exception */ public function testCheckRouteException() { $router = new Router(false); $router->setDI(\Phalcon\Di::getDefault()); $router->add('/test', ['controller' => 'Test', 'action' => 'index'], ['GET'], 2); }