Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 85480142c133cbeaf844c0dcdd21f06fc53184c7 1 parent cd0a1ff
@chillu chillu authored
Showing with 6 additions and 4 deletions.
  1. +3 −2 cli-script.php
  2. +3 −2 tests/bootstrap.php
View
5 cli-script.php
@@ -37,7 +37,8 @@
*/
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 @@
$_GET = array_merge($_GET, $newItems);
}
}
- $_REQUEST = $_GET;
+ $_REQUEST = array_merge($_REQUEST, $_GET);
}
// Set 'url' GET parameter
View
5 tests/bootstrap.php
@@ -28,7 +28,8 @@
// 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 @@
$_GET = array_merge($_GET, $newItems);
}
}
- $_REQUEST = $_GET;
+ $_REQUEST = array_merge($_REQUEST, $_GET);
}
// Always flush the manifest for phpunit test runs
Please sign in to comment.
Something went wrong with that request. Please try again.