mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
cd0a1ff623
commit
85480142c1
@ -37,7 +37,8 @@ chdir(dirname($_SERVER['SCRIPT_FILENAME']));
|
|||||||
*/
|
*/
|
||||||
if(isset($_SERVER['argv'][2])) {
|
if(isset($_SERVER['argv'][2])) {
|
||||||
$args = array_slice($_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) {
|
foreach($args as $arg) {
|
||||||
if(strpos($arg,'=') == false) {
|
if(strpos($arg,'=') == false) {
|
||||||
$_GET['args'][] = $arg;
|
$_GET['args'][] = $arg;
|
||||||
@ -47,7 +48,7 @@ if(isset($_SERVER['argv'][2])) {
|
|||||||
$_GET = array_merge($_GET, $newItems);
|
$_GET = array_merge($_GET, $newItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_REQUEST = $_GET;
|
$_REQUEST = array_merge($_REQUEST, $_GET);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set 'url' GET parameter
|
// Set 'url' GET parameter
|
||||||
|
@ -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.
|
// Copied from cli-script.php, to enable same behaviour through phpunit runner.
|
||||||
if(isset($_SERVER['argv'][2])) {
|
if(isset($_SERVER['argv'][2])) {
|
||||||
$args = array_slice($_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) {
|
foreach($args as $arg) {
|
||||||
if(strpos($arg,'=') == false) {
|
if(strpos($arg,'=') == false) {
|
||||||
$_GET['args'][] = $arg;
|
$_GET['args'][] = $arg;
|
||||||
@ -38,7 +39,7 @@ if(isset($_SERVER['argv'][2])) {
|
|||||||
$_GET = array_merge($_GET, $newItems);
|
$_GET = array_merge($_GET, $newItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_REQUEST = $_GET;
|
$_REQUEST = array_merge($_REQUEST, $_GET);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always flush the manifest for phpunit test runs
|
// Always flush the manifest for phpunit test runs
|
||||||
|
Loading…
Reference in New Issue
Block a user