mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Making constructClasses() call run against the correct object. test cases updated.
Fixes #4
This commit is contained in:
parent
b731408deb
commit
31d136ca67
2 changed files with 5 additions and 3 deletions
|
@ -391,7 +391,8 @@ class TestTask extends Shell {
|
|||
return "ClassRegistry::init('$fullClassName');\n";
|
||||
}
|
||||
if ($type == 'controller') {
|
||||
return "new Test$fullClassName();\n\t\t\$this->{$fullClassName}->constructClasses();\n";
|
||||
$className = substr($fullClassName, 0, strlen($fullClassName) - 10);
|
||||
return "new Test$fullClassName();\n\t\t\$this->{$className}->constructClasses();\n";
|
||||
}
|
||||
return "new $fullClassName()\n";
|
||||
}
|
||||
|
|
|
@ -362,7 +362,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
$this->assertPattern('/function redirect\(\$url, \$status = null, \$exit = true\)/', $result);
|
||||
|
||||
$this->assertPattern('/function startTest\(\)/', $result);
|
||||
$this->assertPattern("/\\\$this->TestTaskComments \=\& new TestTestTaskCommentsController()/", $result);
|
||||
$this->assertPattern("/\\\$this->TestTaskComments \=\& new TestTestTaskCommentsController\(\)/", $result);
|
||||
$this->assertPattern("/\\\$this->TestTaskComments->constructClasses\(\)/", $result);
|
||||
|
||||
$this->assertPattern('/function endTest\(\)/', $result);
|
||||
$this->assertPattern('/unset\(\$this->TestTaskComments\)/', $result);
|
||||
|
@ -382,7 +383,7 @@ class TestTaskTest extends CakeTestCase {
|
|||
**/
|
||||
function testGenerateContsructor() {
|
||||
$result = $this->Task->generateConstructor('controller', 'PostsController');
|
||||
$expected = "new TestPostsController();\n\t\t\$this->PostsController->constructClasses();\n";
|
||||
$expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n";
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Task->generateConstructor('model', 'Post');
|
||||
|
|
Loading…
Add table
Reference in a new issue