mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
preventing the possibility of trying to delete / if the test dir wasn't created correctly
And the ensuing exception if permission is denied
This commit is contained in:
parent
b7b27e3f03
commit
803d19c80e
1 changed files with 21 additions and 8 deletions
|
@ -38,7 +38,6 @@ if (!class_exists('ShellDispatcher')) {
|
|||
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 @@ class PluginTaskTest extends CakeTestCase {
|
|||
$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 @@ class PluginTaskTest extends CakeTestCase {
|
|||
$this->Task->args = array();
|
||||
$this->Task->execute();
|
||||
|
||||
$Folder =& new Folder($path);
|
||||
$Folder->delete();
|
||||
$this->_rmDir($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,8 +233,7 @@ class PluginTaskTest extends CakeTestCase {
|
|||
|
||||
$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 @@ class PluginTaskTest extends CakeTestCase {
|
|||
$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();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue