Пример #1
0
 public function test追加したルーティング先にディスパッチする()
 {
     $appPath = GENE_TEST_ROOT . '/var/config/routing.ini';
     $config = Gene_Config::load($appPath);
     $routing = new Gene_Application_Setting_Routing($config->routes);
     $modules = dirname(__FILE__) . '/var/modules/';
     $front = Zend_Controller_Front::getInstance();
     $router = $front->getRouter();
     $routes = $routing->add($router)->getRouter();
     $front->setDefaultModule('index')->addModuleDirectory($modules);
     $request = new Zend_Controller_Request_Http('http://localhost');
     $params = '/admin/list';
     $request->setRequestUri($params);
     $response = $front->returnResponse(true)->setParam('noViewRenderer', true)->dispatch($request);
     $body = $response->getBody();
     $this->assertEquals($body, 'Admin_IndexController::listAction');
     $response->clearAllHeaders()->clearBody();
 }
Пример #2
0
 /**
  * Init routing
  *
  * @access protected
  * @return Gene_Bootstrap Fluent interface
  */
 protected function _initRouting()
 {
     $path = $this->_configPath . 'routing.ini';
     $config = Gene_Config::load($path, $this->_cache);
     if (is_null($config->routes)) {
         return $this;
     }
     $router = new Gene_Application_Setting_Routing($config->routes);
     $front = Zend_Controller_Front::getInstance();
     $router->add($front->getRouter());
     return $this;
 }