Making constructClasses() call run against the correct object. test cases updated.

Fixes #4
This commit is contained in:
mark_story 2009-08-05 20:45:54 -04:00
parent b731408deb
commit 31d136ca67
2 changed files with 5 additions and 3 deletions

View file

@ -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";
}

View file

@ -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');