Skip to content
Browse files

Fix for Consolce/Task/TestTask::getRealClassName(). Controller names …

…of exactly 10 letters

being returned incorrectly

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
1 parent 757579e commit 8e93c4cd349f20ee5fa67307db599bb1d4671ca0 @robmcvey robmcvey committed with markstory
View
5 lib/Cake/Console/Command/Task/TestTask.php
@@ -274,7 +274,10 @@ public function getRealClassName($type, $class) {
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
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 . $type;
View
3 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -403,6 +403,9 @@ public function testGetRealClassname() {
$result = $this->Task->getRealClassname('Controller', 'PostsController');
$this->assertEquals('PostsController', $result);
+
+ $result = $this->Task->getRealClassname('Controller', 'AlertTypes');
+ $this->assertEquals('AlertTypesController', $result);
$result = $this->Task->getRealClassname('Helper', 'Form');
$this->assertEquals('FormHelper', $result);

0 comments on commit 8e93c4c

Please sign in to comment.
Something went wrong with that request. Please try again.