mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Parsing every parameter until there is no more. Good to have alias but with the ability to override the arguments.
This commit is contained in:
parent
9f80004920
commit
d9e8b3b6a2
2 changed files with 20 additions and 2 deletions
|
@ -288,8 +288,7 @@ class ShellDispatcher {
|
|||
$parsed = array();
|
||||
$keys = array('-working', '--working', '-app', '--app', '-root', '--root');
|
||||
foreach ($keys as $key) {
|
||||
$index = array_search($key, $args);
|
||||
if ($index !== false) {
|
||||
while (($index = array_search($key, $args)) !== false) {
|
||||
$keyname = str_replace('-', '', $key);
|
||||
$valueIndex = $index + 1;
|
||||
$parsed[$keyname] = $args[$valueIndex];
|
||||
|
|
|
@ -365,6 +365,25 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$Dispatcher->parseParams($params);
|
||||
$this->assertEqual($expected, $Dispatcher->params);
|
||||
|
||||
$params = array(
|
||||
'/cake/1.2.x.x/cake/console/cake.php',
|
||||
'bake',
|
||||
'-app',
|
||||
'new',
|
||||
'-app',
|
||||
'old',
|
||||
'-working',
|
||||
'/var/www/htdocs'
|
||||
);
|
||||
$expected = array(
|
||||
'app' => 'old',
|
||||
'webroot' => 'webroot',
|
||||
'working' => str_replace('/', DS, '/var/www/htdocs/old'),
|
||||
'root' => str_replace('/', DS,'/var/www/htdocs')
|
||||
);
|
||||
$Dispatcher->parseParams($params);
|
||||
$this->assertEqual($expected, $Dispatcher->params);
|
||||
|
||||
if (DS === '\\') {
|
||||
$params = array(
|
||||
'cake.php',
|
||||
|
|
Loading…
Add table
Reference in a new issue