/**
  * Ensures that removeSuffix() does not modify the string if it does not
  * end with the suffix but contains it.
  */
 public function testRemoveSuffixDoesNotModifyStringIfItOnlyContainsSuffix()
 {
     $result = Mol_Util_String::removeSuffix('this is a test string', 'test');
     $this->assertEquals('this is a test string', $result);
 }
Beispiel #2
0
 /**
  * Removes the given suffix from the string.
  *
  * This method has no effect if the string does not end with $suffix.
  *
  * @param string|Mol_DataType_String $suffix
  * @return Mol_DataType_String String without suffix.
  */
 public function removeSuffix($suffix)
 {
     $suffix = $this->toValue($suffix);
     return $this->createString(Mol_Util_String::removeSuffix($this->value, $suffix));
 }
 /**
  * Returns the name of the controller.
  *
  * @return string
  */
 protected function getControllerName()
 {
     $name = $this->getControllerClass();
     $positionOfLastUnderscore = strrpos($name, '_');
     if ($positionOfLastUnderscore !== false) {
         $name = substr($name, $positionOfLastUnderscore + 1);
     }
     $name = Mol_Util_String::removeSuffix($name, 'Controller');
     $name = Zend_Filter::filterStatic($name, 'Word_CamelCaseToDash');
     return strtolower($name);
 }