Fix for Consolce/Task/TestTask::getRealClassName(). Controller names of exactly 10 letters

being returned incorrectly

Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
Rob McVey 2012-02-28 14:58:28 +00:00 committed by mark_story
parent 757579e1d1
commit 8e93c4cd34
2 changed files with 7 additions and 1 deletions

View file

@ -274,7 +274,10 @@ class TestTask extends BakeTask {
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) { if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
return $class; return $class;
} }
if (strlen($class) - strpos($class, $type) == strlen($type)) {
$position = strpos($class, $type);
if ($position !== false && strlen($class) - $position == strlen($type)) {
return $class; return $class;
} }
return $class . $type; return $class . $type;

View file

@ -403,6 +403,9 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getRealClassname('Controller', 'PostsController'); $result = $this->Task->getRealClassname('Controller', 'PostsController');
$this->assertEquals('PostsController', $result); $this->assertEquals('PostsController', $result);
$result = $this->Task->getRealClassname('Controller', 'AlertTypes');
$this->assertEquals('AlertTypesController', $result);
$result = $this->Task->getRealClassname('Helper', 'Form'); $result = $this->Task->getRealClassname('Helper', 'Form');
$this->assertEquals('FormHelper', $result); $this->assertEquals('FormHelper', $result);