Permalink
Browse files

Adding tests for other object types.

  • Loading branch information...
1 parent 975aab8 commit 66b36ba3b8ebb8d329c84ebf08eccdf1d12f3444 @markstory markstory committed May 25, 2009
Showing with 12 additions and 4 deletions.
  1. +3 −3 cake/console/libs/tasks/test.php
  2. +9 −1 cake/tests/cases/console/libs/tasks/test.test.php
@@ -390,12 +390,12 @@ function generateMockClass($type, $class) {
function generateConstructor($type, $fullClassName) {
$type = strtolower($type);
if ($type == 'model') {
- return "ClassRegistry::init('$fullClassName');";
+ return "ClassRegistry::init('$fullClassName');\n";
}
if ($type == 'controller') {
- return "new Test$fullClassName();\n\t\t\$this->{$fullClassName}->constructClasses();";
+ return "new Test$fullClassName();\n\t\t\$this->{$fullClassName}->constructClasses();\n";
}
- return "new $fullClassName";
+ return "new $fullClassName()\n";
}
/**
@@ -312,7 +312,15 @@ function testBake() {
**/
function testGenerateContsructor() {
$result = $this->Task->generateConstructor('controller', 'PostsController');
- $expected = "new TestPostsController();\n\t\t\$this->PostsController->constructClasses();";
+ $expected = "new TestPostsController();\n\t\t\$this->PostsController->constructClasses();\n";
+ $this->assertEqual($result, $expected);
+
+ $result = $this->Task->generateConstructor('model', 'Post');
+ $expected = "ClassRegistry::init('Post');\n";
+ $this->assertEqual($result, $expected);
+
+ $result = $this->Task->generateConstructor('helper', 'FormHelper');
+ $expected = "new FormHelper()\n";
$this->assertEqual($result, $expected);
}
}

0 comments on commit 66b36ba

Please sign in to comment.