mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 20:46:24 +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 . 'plugin.php';
|
||||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php';
|
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php';
|
||||||
|
|
||||||
|
|
||||||
Mock::generatePartial(
|
Mock::generatePartial(
|
||||||
'ShellDispatcher', 'TestPluginTaskMockShellDispatcher',
|
'ShellDispatcher', 'TestPluginTaskMockShellDispatcher',
|
||||||
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
||||||
|
@ -187,8 +186,7 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$file = $path . DS . 'bake_test_plugin_app_model.php';
|
$file = $path . DS . 'bake_test_plugin_app_model.php';
|
||||||
$this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s');
|
$this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s');
|
||||||
|
|
||||||
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
$this->_rmDir($this->Task->path . 'bake_test_plugin');
|
||||||
$Folder->delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,8 +210,7 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$this->Task->args = array();
|
$this->Task->args = array();
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
|
|
||||||
$Folder =& new Folder($path);
|
$this->_rmDir($path);
|
||||||
$Folder->delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,8 +233,7 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
|
|
||||||
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
$this->_rmDir($this->Task->path . 'bake_test_plugin');
|
||||||
$Folder->delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,7 +254,24 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$this->Task->Model->expectOnce('loadTasks');
|
$this->Task->Model->expectOnce('loadTasks');
|
||||||
$this->Task->Model->expectOnce('execute');
|
$this->Task->Model->expectOnce('execute');
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
|
|
||||||
|
$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();
|
$Folder->delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue