Exemplo n.º 1
0
 /**
  * @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);
 }
Exemplo n.º 2
0
 /**
  * @expectedException Exception
  */
 public function testCheckRouteException()
 {
     $router = new Router(false);
     $router->setDI(\Phalcon\Di::getDefault());
     $router->add('/test', ['controller' => 'Test', 'action' => 'index'], ['GET'], 2);
 }