diff --git a/cake/tests/cases/console/libs/tasks/plugin.test.php b/cake/tests/cases/console/libs/tasks/plugin.test.php index 1a78e275a26..e007028f862 100644 --- a/cake/tests/cases/console/libs/tasks/plugin.test.php +++ b/cake/tests/cases/console/libs/tasks/plugin.test.php @@ -38,7 +38,6 @@ require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'plugin.php'; require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; - Mock::generatePartial( 'ShellDispatcher', 'TestPluginTaskMockShellDispatcher', array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment') @@ -187,8 +186,7 @@ function testBakeFoldersAndFiles() { $file = $path . DS . 'bake_test_plugin_app_model.php'; $this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s'); - $Folder =& new Folder($this->Task->path . 'bake_test_plugin'); - $Folder->delete(); + $this->_rmDir($this->Task->path . 'bake_test_plugin'); } /** @@ -212,8 +210,7 @@ function testExecuteWithNoArgs() { $this->Task->args = array(); $this->Task->execute(); - $Folder =& new Folder($path); - $Folder->delete(); + $this->_rmDir($path); } /** @@ -236,8 +233,7 @@ function testExecuteWithOneArg() { $this->Task->execute(); - $Folder =& new Folder($this->Task->path . 'bake_test_plugin'); - $Folder->delete(); + $this->_rmDir($this->Task->path . 'bake_test_plugin'); } /** @@ -258,7 +254,24 @@ function testExecuteWithTwoArgs() { $this->Task->Model->expectOnce('loadTasks'); $this->Task->Model->expectOnce('execute'); $this->Task->execute(); - $Folder->delete(); + + $this->_rmDir($this->Task->path . 'bake_test_plugin'); + } + +/** + * rmDir method + * + * If the folder exists - delete it + * + * @param mixed $path + * @return void + * @access protected + */ + function _rmDir($path) { + if (is_dir($path)) { + $Folder =& new Folder($path); + $Folder->delete(); + } } } ?> \ No newline at end of file