CLI bootstrap: Merge existing $_GET and $_REQUEST data

Necessary to have the <get name="db" /> directive
working in phpunit.xml definitions, which in turns allows
us to use GET parameters to switch the database connection
for running automated tests.
This commit is contained in:
Ingo Schommer 2012-07-04 12:05:31 +02:00
parent cd0a1ff623
commit 85480142c1
2 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,8 @@ chdir(dirname($_SERVER['SCRIPT_FILENAME']));
*/
if(isset($_SERVER['argv'][2])) {
$args = array_slice($_SERVER['argv'],2);
$_GET = array();
if(!isset($_GET)) $_GET = array();
if(!isset($_REQUEST)) $_REQUEST = array();
foreach($args as $arg) {
if(strpos($arg,'=') == false) {
$_GET['args'][] = $arg;
@ -47,7 +48,7 @@ if(isset($_SERVER['argv'][2])) {
$_GET = array_merge($_GET, $newItems);
}
}
$_REQUEST = $_GET;
$_REQUEST = array_merge($_REQUEST, $_GET);
}
// Set 'url' GET parameter

View File

@ -28,7 +28,8 @@ if(!defined('BASE_PATH')) define('BASE_PATH', dirname($frameworkPath));
// Copied from cli-script.php, to enable same behaviour through phpunit runner.
if(isset($_SERVER['argv'][2])) {
$args = array_slice($_SERVER['argv'],2);
$_GET = array();
if(!isset($_GET)) $_GET = array();
if(!isset($_REQUEST)) $_REQUEST = array();
foreach($args as $arg) {
if(strpos($arg,'=') == false) {
$_GET['args'][] = $arg;
@ -38,7 +39,7 @@ if(isset($_SERVER['argv'][2])) {
$_GET = array_merge($_GET, $newItems);
}
}
$_REQUEST = $_GET;
$_REQUEST = array_merge($_REQUEST, $_GET);
}
// Always flush the manifest for phpunit test runs