Beispiel #1
0
 function testCamelCase()
 {
     $this->assertEquals('myString', S::camelCaseFrom('my-string'));
     $this->assertEquals('myString', S::camelCaseFrom('my_string', '_'));
     $this->assertEquals('myStringIsCool', S::camelCaseFrom('my#string#is#cool', '#'));
     $this->assertEquals('myStringIsCool', S::camelCaseFrom('my_string_is_cool', '_'));
     $this->assertEquals('my-stringIsCool', S::camelCaseFrom('my-string_is_cool', '_'));
     $this->assertEquals('my-string', S::camelCaseTo('myString'));
     $this->assertEquals('my-string', S::camelCaseTo('MyString'));
     $this->assertEquals('my_string', S::camelCaseTo('myString', '_'));
     $this->assertEquals('my-string-is-cool', S::camelCaseTo('myStringIsCool'));
     $this->assertEquals('my_string_is_cool', S::camelCaseTo('myStringIsCool', '_'));
     $this->assertEquals('my string is cool', S::camelCaseTo('myStringIsCool', ' '));
 }
 /**
  * Converts a camelCased class name to a underscored table name
  *
  * @param string $className the name of a corresponding class
  * @param string $tableName optional the real table name
  *
  * @return string MUST return a tuple table name blank alias name
  */
 public function tableName($className, $tableName = null)
 {
     return $tableName ? $tableName . ' ' . $className : StringUtils::camelCaseTo($className, '_') . ' ' . $className;
 }