diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index 3a2d69509..c3d0b8366 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -75,8 +75,11 @@ class ControllerTask extends Shell { } } } - $baked = $this->__bake($controller, $actions); - $this->__bakeTest($controller); + if ($this->__bake($controller, $actions)) { + if ($this->_checkUnitTest()) { + $this->__bakeTest($controller); + } + } } } /** @@ -472,12 +475,7 @@ class ControllerTask extends Shell { $filename = Inflector::underscore($className).'_controller.test.php'; $this->out("Baking unit test for $className..."); - $Folder =& new Folder($path, true); - if ($path = $Folder->cd($path)) { - $path = $Folder->slashTerm($path); - return $this->createFile($path . $filename, $out); - } - return false; + return $this->createFile($path . $filename, $out); } /** * Outputs and gets the list of possible models or controllers from database diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 4617c77a8..fb635bd10 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -591,12 +591,7 @@ class ModelTask extends Shell { $filename = Inflector::underscore($className).'.test.php'; $this->out("Baking unit test for $className..."); - $Folder =& new Folder($path, true); - if ($path = $Folder->cd($path)) { - $path = $Folder->slashTerm($path); - return $this->createFile($path . $filename, $out); - } - return false; + return $this->createFile($path . $filename, $out); } /** * outputs the a list of possible models or controllers from database