예제 #1
0
 protected function _checkRenderProperties()
 {
     $this->assertEquals('foo', $this->helper->getScriptAction());
     $this->assertEquals('bar', $this->helper->getResponseSegment());
     $this->assertTrue($this->helper->getNoController());
 }
예제 #2
0
 /**
  * Tries to render a delegate action's default template if it exists.
  *
  * Because we can't always know the short name of a delegate (like we can
  * with a controller), the default view spec of :controller/:action:suffix
  * won't work for us. This means we can't just prepend our default paths to
  * the view script paths. Instead, this function changes the viewRenderer
  * spec to just :action:suffix, puts in the default dirs, tries to render
  * and then flips back the settings afterwards. 
  *
  * @todo Ugly, needs refactoring
  * @param Zend_Controller_Action_Helper_ViewRenderer $viewRenderer
  * @param Zend_View_Abstract $view
  * @param string $action Name of the action, without the "Action" suffix
  */
 protected function _renderDefaultScript($viewRenderer, $view, $action)
 {
     //No settings? Abort to save cycles
     $defaultPaths = $this->getDefaultScriptPaths();
     if (empty($defaultPaths)) {
         return;
     }
     //Save the old settings
     $oldSpec = $viewRenderer->getNoController();
     $oldPaths = $view->getScriptPaths();
     //Set the viewrenderer spec to look inside a flat directory
     $viewRenderer->setNoController(true);
     $view->setScriptPath($defaultPaths);
     $path = $viewRenderer->getViewScript($action);
     //relative path
     $fullPath = $view->getScriptPath($path);
     //absolute path
     //We use the full path to make sure this template actually exists on
     //disc but Zend_View will only accept a path relative to a script dir.
     if (!empty($fullPath) !== false) {
         $viewRenderer->renderScript($path);
     }
     //Reset view settings so we don't botch anything afterwards?
     $viewRenderer->setNoController($oldSpec);
     $view->setScriptPath($oldPaths);
 }