Skip to content

Commit

Permalink
No startup and teardown for controller tests
Browse files Browse the repository at this point in the history
and.. no startup/teardown functions unless they are actually going to do more
than just call parent
  • Loading branch information
AD7six committed Jun 6, 2012
1 parent 51635c2 commit a5fabcc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/Cake/Console/Command/Task/TestTask.php
Expand Up @@ -459,11 +459,6 @@ public function generateConstructor($type, $fullClassName, $plugin) {
if ($type == 'behavior') {
$construct = "new $fullClassName();\n";
}
if ($type == 'controller') {
$className = substr($fullClassName, 0, -10);
$construct = "new $fullClassName();\n";

This comment has been minimized.

Copy link
@ceeram

ceeram Jun 6, 2012

Contributor

$construct has no default value, and if it had, the testcases were not updated for the missing setup/teardown

$post = "\$this->{$className}->constructClasses();\n";
}
if ($type == 'helper') {
$pre = "\$View = new View();\n";
$construct = "new {$fullClassName}(\$View);\n";
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Console/Templates/default/classes/test.ctp
Expand Up @@ -44,6 +44,7 @@ class <?php echo $fullClassName; ?>Test extends CakeTestCase {
);

<?php endif; ?>
<?php if (!empty($construction)): ?>
/**
* setUp method
*
Expand All @@ -67,6 +68,7 @@ class <?php echo $fullClassName; ?>Test extends CakeTestCase {
parent::tearDown();
}

<?php endif; ?>
<?php foreach ($methods as $method): ?>
/**
* test<?php echo Inflector::camelize($method); ?> method
Expand Down

0 comments on commit a5fabcc

Please sign in to comment.