Skip to content

Commit

Permalink
Rename Inflector::hyphenate() to Inflector::dasherized()
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 2, 2014
1 parent 55e8755 commit 7ba6162
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/Utility/Inflector.php
Expand Up @@ -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;
Expand Down
26 changes: 11 additions & 15 deletions tests/TestCase/Utility/InflectorTest.php
@@ -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)
*
Expand Down Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit 7ba6162

Please sign in to comment.