Exemplo n.º 1
0
 /**
  * Set inflector
  *
  * @param  \Zend\Filter\Inflector $inflector
  * @param  boolean               $reference Whether the moduleDir, target, and suffix should be set as references to ViewRenderer properties
  * @return \Zend\Controller\Action\Helper\ViewRenderer Provides a fluent interface
  */
 public function setInflector(Filter\Inflector $inflector, $reference = false)
 {
     $this->_inflector = $inflector;
     if ($reference) {
         $this->_inflector->setStaticRuleReference('suffix', $this->_viewSuffix)->setStaticRuleReference('moduleDir', $this->_moduleDir)->setTargetReference($this->_inflectorTarget);
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * @issue ZF-7544
  */
 public function testAddFilterRuleMultipleTimes()
 {
     $rules = $this->inflector->getRules();
     $this->assertEquals(0, count($rules));
     $this->inflector->setFilterRule('controller', 'PregReplace');
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(1, count($rules));
     $this->inflector->addFilterRule('controller', array('Alpha', 'StringToLower'));
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(3, count($rules));
     $this->_context = 'StringToLower';
     $this->inflector->setStaticRuleReference('context', $this->_context);
     $this->inflector->addFilterRule('controller', array('Alpha', 'StringToLower'));
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(5, count($rules));
 }
Exemplo n.º 3
0
 /**
  * @issue ZF-7544
  */
 public function testAddFilterRuleMultipleTimes()
 {
     if (!extension_loaded('intl')) {
         $this->markTestSkipped('ext/intl not enabled');
     }
     $rules = $this->inflector->getRules();
     $this->assertEquals(0, count($rules));
     $this->inflector->setFilterRule('controller', 'PregReplace');
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(1, count($rules));
     $this->inflector->addFilterRule('controller', array('Alpha', 'StringToLower'));
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(3, count($rules));
     $this->_context = 'StringToLower';
     $this->inflector->setStaticRuleReference('context', $this->_context);
     $this->inflector->addFilterRule('controller', array('Alpha', 'StringToLower'));
     $rules = $this->inflector->getRules('controller');
     $this->assertEquals(5, count($rules));
 }