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); }
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); }
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); }
/** * 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); }