Ejemplo n.º 1
0
 public function testSetRulesCreatesAppropriateRuleEntries()
 {
     $this->inflector->setStaticRule('some-rules', 'some-value');
     $rules = $this->inflector->getRules();
     $this->assertEquals(1, count($rules));
     $this->inflector->setRules(array(':controller' => array('PregReplace', 'Alpha'), 'suffix' => 'phtml'));
     $rules = $this->inflector->getRules();
     $this->assertEquals(2, count($rules));
     $this->assertEquals(2, count($rules['controller']));
     $this->assertEquals('phtml', $rules['suffix']);
 }
Ejemplo n.º 2
0
 public function testSetRulesCreatesAppropriateRuleEntries()
 {
     if (!extension_loaded('intl')) {
         $this->markTestSkipped('ext/intl not enabled');
     }
     $this->inflector->setStaticRule('some-rules', 'some-value');
     $rules = $this->inflector->getRules();
     $this->assertEquals(1, count($rules));
     $this->inflector->setRules(array(':controller' => array('PregReplace', 'Alpha'), 'suffix' => 'phtml'));
     $rules = $this->inflector->getRules();
     $this->assertEquals(2, count($rules));
     $this->assertEquals(2, count($rules['controller']));
     $this->assertEquals('phtml', $rules['suffix']);
 }
Ejemplo n.º 3
0
 /**
  * Returns template name
  *
  * If a template name is not specified as a widget's param
  * it is auto created from widget type name
  * (Note: each word of the widget type name will be separated with a dash ('-').
  *
  * @return string
  */
 protected function prepareTplName()
 {
     // We're separating each word of a widget class name using a dash (‘-‘).
     $inflector = new Inflector(':tplName');
     $inflector->setRules(array(':tplName' => array('Word\\CamelCaseToDash')));
     $className = $this->getWidgetTypeName();
     $tplName = $inflector->filter(array('tplName' => $className));
     return $tplName;
 }