Permalink
Browse files

remove stub class from controller tests template and mock condition to

make it extends ControllerTestCase
  • Loading branch information...
1 parent a238116 commit c651bf25d3be33d6f3bf99072ce5e5c054b79927 @huoxito huoxito committed May 11, 2012
Showing with 2 additions and 31 deletions.
  1. +1 −1 lib/Cake/Console/Command/Task/TestTask.php
  2. +1 −30 lib/Cake/Console/Templates/default/classes/test.ctp
@@ -460,7 +460,7 @@ public function generateConstructor($type, $fullClassName, $plugin) {
}
if ($type == 'controller') {
$className = substr($fullClassName, 0, -10);
- $construct = "new Test$fullClassName();\n";
+ $construct = "new $fullClassName();\n";
$post = "\$this->{$className}->constructClasses();\n";
}
if ($type == 'helper') {
@@ -23,40 +23,11 @@ echo "<?php\n";
App::uses('<?php echo $dependency[0]; ?>', '<?php echo $dependency[1]; ?>');
<?php endforeach; ?>
-<?php if ($mock && strtolower($type) === 'controller'): ?>
-/**
- * Test<?php echo $fullClassName; ?>
- *
- */
-class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
-
-/**
- * Auto render
- *
- * @var boolean
- */
- public $autoRender = false;
-
-/**
- * Redirect action
- *
- * @param mixed $url
- * @param mixed $status
- * @param boolean $exit
- * @return void
- */
- public function redirect($url, $status = null, $exit = true) {
- $this->redirectUrl = $url;
- }
-
-}
-
-<?php endif; ?>
/**
* <?php echo $fullClassName; ?> Test Case
*
*/
-<?php if ($mock and strtolower($type) == 'controller'): ?>
+<?php if ($type === 'Controller'): ?>
class <?php echo $fullClassName; ?>TestCase extends ControllerTestCase {
<?php else: ?>
class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {

0 comments on commit c651bf2

Please sign in to comment.