public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag() { $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); $controller = new \Bar\IndexController($this->request, $this->response, array()); $controller->setHelperBroker($this->broker); $this->helper->view->resolver()->addPath($this->basePath . '/_files/modules/bar/views'); $inflector = new 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 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); }
/** * @issue ZF-2964 */ public function testNoInflectableTarget() { $inflector = new InflectorFilter('abc'); $inflector->addRules(array(':foo' => array())); $this->assertEquals($inflector(array('fo' => 'bar')), 'abc'); }