diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index 66646f597..b9d8b0373 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -274,7 +274,10 @@ class TestTask extends BakeTask { 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; diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index cb7fe00c9..3dcd27839 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -403,6 +403,9 @@ class TestTaskTest extends CakeTestCase { $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);