public function testPreDispatchWithDefaults()
 {
     $this->request->setModuleName('foo')->setControllerName('index');
     $controller = new Foo_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $this->helper->preDispatch();
     $this->_checkDefaults();
 }
예제 #2
0
 public function testPredispatchWithTwigTemplateEngine()
 {
     $this->request->setModuleName('foo')->setControllerName('index')->setActionName('bar');
     $controller = new Foo_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $view = new Ano_View();
     $engine = new Ano_View_Engine_PhpEngine($view);
     $view->addTemplateEngine('twig', $engine);
     $this->helper->setView($view);
     $this->helper->preDispatch();
     $this->assertSame($engine, $this->helper->view->getTemplateEngine());
 }
 public function preDispatch()
 {
     $prefix = substr($this->getRequest()->getParam('action'), 0, 4);
     if ($prefix == 'json' || $this->_actionController instanceof Zend_Rest_Controller) {
         $this->getRequest()->setParam('jsonOutput', true);
     }
     $module = $this->getRequest()->getParam('module');
     if ($this->isJson()) {
         $this->setView(new Kwf_View_Json());
     } else {
         $this->setView(new Kwf_View_Ext());
     }
     if (null !== $this->_actionController && null === $this->_actionController->view) {
         $this->_actionController->view = $this->view;
     }
     parent::preDispatch();
 }