mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
757579e1d1
commit
8e93c4cd34
2 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -404,6 +404,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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue