From 7ba61620f54eb0cb0d1a6d0ae622a376210e600e Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 2 Sep 2014 10:44:24 +0530 Subject: [PATCH] Rename Inflector::hyphenate() to Inflector::dasherized() --- src/Utility/Inflector.php | 8 ++++---- tests/TestCase/Utility/InflectorTest.php | 26 ++++++++++-------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Utility/Inflector.php b/src/Utility/Inflector.php index e7f6833ee48..c13bb0ceb7d 100644 --- a/src/Utility/Inflector.php +++ b/src/Utility/Inflector.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; diff --git a/tests/TestCase/Utility/InflectorTest.php b/tests/TestCase/Utility/InflectorTest.php index d5c6a377427..58840709e36 100644 --- a/tests/TestCase/Utility/InflectorTest.php +++ b/tests/TestCase/Utility/InflectorTest.php @@ -1,9 +1,5 @@ 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)); } /**