Skip to content
Permalink
Browse files

Fix regression in camelize().

The input should not be lowercased before camelizing, as this can cause
inputs that were previously camelized to create incorrect results.

Refs #6735
  • Loading branch information...
markstory committed Jun 5, 2015
1 parent b8b5243 commit 239c83938f1c238900fef1ab0996a6cfd9975727
Showing with 14 additions and 1 deletion.
  1. +14 −0 lib/Cake/Test/Case/Utility/InflectorTest.php
  2. +0 −1 lib/Cake/Utility/Inflector.php
@@ -460,6 +460,20 @@ public function testInflectorUnderscore() {
$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
*
@@ -500,7 +500,6 @@ public static function underscore($camelCasedWord) {
*/
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);

0 comments on commit 239c839

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