예제 #1
0
    public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());

        $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views');

        require_once 'Zend/Filter/PregReplace.php';
        require_once 'Zend/Filter/Word/UnderscoreToSeparator.php';
        
        $inflector = new Zend_Filter_Inflector('test.phtml');
        $inflector->addRules(array(
            ':module'     => array('Word_CamelCaseToDash', 'stringToLower'),
            ':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator(DIRECTORY_SEPARATOR), 'StringToLower'),
            ':action'     => array(
                'Word_CamelCaseToDash', 
                new Zend_Filter_PregReplace('/[^a-z0-9]+/i', '-'),
                'StringToLower'
            ),
        ));
        $this->helper->setInflector($inflector, true);

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }
예제 #2
0
 public function testRenderToNamedSegment()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('test');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->render(null, 'foo');
     $body = $this->response->getBody('foo');
     $this->assertContains('Rendered index/test.phtml in bar module', $body);
 }
예제 #3
0
 function render($action = null, $name = null, $noController = null)
 {
     if (isset($this->_actionController->block)) {
         $this->renderBlock($this->_actionController->block);
     } else {
         parent::render($action, $name, $noController);
     }
 }
 public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule()
 {
     require_once $this->basePath . '/_files/modules/default/controllers/Admin/HelperController.php';
     $this->request->setControllerName('admin_helper')->setActionName('render');
     $controller = new Admin_HelperController($this->request, $this->response, array());
     $this->helper->render();
     $body = $this->response->getBody();
     $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body);
 }
예제 #5
0
파일: ViewRenderer.php 프로젝트: kokx/Firal
 /**
  * Render, and add the theme directory as base path
  *
  * @return void
  */
 public function render($action = null, $name = null, $noController = null)
 {
     $this->view->addBasePath($this->getThemeDirectory());
     parent::render($action, $name, $noController);
 }