Skip to content
Permalink
Browse files

Rename Inflector::hyphenate() to Inflector::dasherized()

  • Loading branch information...
ADmad committed Sep 2, 2014
1 parent 55e8755 commit 7ba61620f54eb0cb0d1a6d0ae622a376210e600e
Showing with 15 additions and 19 deletions.
  1. +4 −4 src/Utility/Inflector.php
  2. +11 −15 tests/TestCase/Utility/InflectorTest.php
@@ -599,12 +599,12 @@ public static function underscore($camelCasedWord) {
}
/**
* Returns the given CamelCasedWordGroup as an hyphenated-word-group.
* Returns the given CamelCasedWordGroup as an dashed-word-group.
*
* @param string $wordGroup The string to hyphenate.
* @return string Hyphenated version of the word group
* @param string $wordGroup The string to dasherize.
* @return string Dashed version of the word group
*/
public static function hyphenate($wordGroup) {
public static function dasherize($wordGroup) {
$result = static::_cache(__FUNCTION__, $wordGroup);
if ($result !== null) {
return $result;
@@ -1,9 +1,5 @@
<?php
/**
* InflectorTest
*
* InflectorTest is used to test cases on the Inflector class
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -376,22 +372,22 @@ public function testInflectorUnderscore() {
}
/**
* testInflectorHyphenate method
* testDasherized method
*
* @return void
*/
public function testInflectorHyphenate() {
$this->assertSame('test-thing', Inflector::hyphenate('TestThing'));
$this->assertSame('test-thing', Inflector::hyphenate('testThing'));
$this->assertSame('test-thing-extra', Inflector::hyphenate('TestThingExtra'));
$this->assertSame('test-thing-extra', Inflector::hyphenate('testThingExtra'));
$this->assertSame('test-this-thing', Inflector::hyphenate('test_this_thing'));
public function testDasherized() {
$this->assertSame('test-thing', Inflector::dasherize('TestThing'));
$this->assertSame('test-thing', Inflector::dasherize('testThing'));
$this->assertSame('test-thing-extra', Inflector::dasherize('TestThingExtra'));
$this->assertSame('test-thing-extra', Inflector::dasherize('testThingExtra'));
$this->assertSame('test-this-thing', Inflector::dasherize('test_this_thing'));
// Test stupid values
$this->assertSame('', Inflector::hyphenate(null));
$this->assertSame('', Inflector::hyphenate(''));
$this->assertSame('0', Inflector::hyphenate(0));
$this->assertSame('', Inflector::hyphenate(false));
$this->assertSame('', Inflector::dasherize(null));
$this->assertSame('', Inflector::dasherize(''));
$this->assertSame('0', Inflector::dasherize(0));
$this->assertSame('', Inflector::dasherize(false));
}
/**

0 comments on commit 7ba6162

Please sign in to comment.
You can’t perform that action at this time.