diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index 8635f39f4..9f54ee1fc 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -460,6 +460,20 @@ class InflectorTest extends CakeTestCase { $this->assertSame(Inflector::underscore(false), ''); } + +/** + * Test camelize() + * + * @return void + */ + public function testCamelize() { + $this->assertSame('BlogArticles', Inflector::camelize('blog_articles')); + $this->assertSame('BlogArticles', Inflector::camelize('blog articles')); + $this->assertSame('MyPlugin.MyClass', Inflector::camelize('MyPlugin.MyClass')); + $this->assertSame('MyPlugin.MyClass', Inflector::camelize('my_plugin.MyClass')); + $this->assertSame('MyPlugin.myClass', Inflector::camelize('MyPlugin.my_class')); + } + /** * testVariableNaming method * diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index d06d4baff..6863d95bb 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -500,7 +500,6 @@ class Inflector { */ public static function humanize($lowerCaseAndUnderscoredWord) { if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { - $lowerCaseAndUnderscoredWord = self::underscore($lowerCaseAndUnderscoredWord); $result = explode(' ', str_replace('_', ' ', $lowerCaseAndUnderscoredWord)); foreach ($result as &$word) { $word = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1);