Copying request params before Core.php exec in PHPUnit bootstrap

Same behaviour as with 3.0 bootstrap.php and the
2.4 cli-script.php (which it is based on).
This allows to use GET switches which are evaluated in _config.php
files, e.g. db=<db-alias> settings for running tests
with various DBs without changing the underlying PHP config.
This commit is contained in:
Ingo Schommer 2013-01-06 22:32:59 +01:00
parent 3fad49e2c0
commit 44c41085b9

View File

@ -19,8 +19,6 @@ function silverstripe_test_autoload($className) {
}
spl_autoload_register('silverstripe_test_autoload');
require_once(getcwd()."/sapphire/core/Core.php");
// Copied from cli-script.php, to enable same behaviour through phpunit runner.
if(isset($_SERVER['argv'][2])) {
$args = array_slice($_SERVER['argv'],2);
@ -37,6 +35,8 @@ if(isset($_SERVER['argv'][2])) {
$_REQUEST = $_GET;
}
require_once(getcwd()."/sapphire/core/Core.php");
// Now set a fake REQUEST_URI
$_SERVER['REQUEST_URI'] = BASE_URL . '/dev/tests/all';