mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating ShellDispatcher to pass tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8112 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
1c76e2e18e
commit
7f853532d9
2 changed files with 10 additions and 6 deletions
|
@ -198,10 +198,14 @@ class ShellDispatcher {
|
|||
*/
|
||||
function __buildPaths() {
|
||||
$paths = array();
|
||||
|
||||
$pluginPaths = Configure::read('pluginPaths');
|
||||
if (!class_exists('Folder')) {
|
||||
require LIBS . 'folder.php';
|
||||
}
|
||||
|
||||
foreach ($pluginPaths as $pluginPath) {
|
||||
$plugins = Configure::listObjects('plugin', $pluginPath);
|
||||
$Folder =& new Folder($pluginPath);
|
||||
list($plugins,) = $Folder->read(false, true);
|
||||
foreach ((array)$plugins as $plugin) {
|
||||
$path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
|
||||
if (file_exists($path)) {
|
||||
|
@ -262,7 +266,6 @@ class ShellDispatcher {
|
|||
Configure::write('debug', 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches a CLI request
|
||||
*
|
||||
|
@ -542,16 +545,19 @@ class ShellDispatcher {
|
|||
|
||||
$this->stdout("\nAvailable Shells:");
|
||||
$_shells = array();
|
||||
|
||||
foreach ($this->shellPaths as $path) {
|
||||
if (is_dir($path)) {
|
||||
$shells = Configure::listObjects('file', $path);
|
||||
$path = str_replace(CORE_PATH, 'CORE/', $path);
|
||||
$path = str_replace(CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS, 'CORE' . DS, $path);
|
||||
$path = str_replace(APP, 'APP' . DS, $path);
|
||||
$path = str_replace(ROOT, 'ROOT', $path);
|
||||
$path = rtrim($path, DS);
|
||||
$this->stdout("\n " . $path . ":");
|
||||
if (empty($shells)) {
|
||||
$this->stdout("\t - none");
|
||||
} else {
|
||||
sort($shells);
|
||||
foreach ($shells as $shell) {
|
||||
if ($shell !== 'shell.php') {
|
||||
$this->stdout("\t " . str_replace('.php', '', $shell));
|
||||
|
|
|
@ -456,12 +456,10 @@ class ShellDispatcherTest extends UnitTestCase {
|
|||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/ APP(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n\t - none";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/ ROOT(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n\t - none";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue