public function PHPUnit_Util_Configuration::handlePHPConfiguration in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Util/Configuration.php \PHPUnit_Util_Configuration::handlePHPConfiguration()
Handles the PHP configuration.
@since Method available since Release 3.2.20
File
- vendor/
phpunit/ phpunit/ src/ Util/ Configuration.php, line 481
Class
- PHPUnit_Util_Configuration
- Wrapper for the PHPUnit XML configuration file.
Code
public function handlePHPConfiguration() {
$configuration = $this
->getPHPConfiguration();
if (!empty($configuration['include_path'])) {
ini_set('include_path', implode(PATH_SEPARATOR, $configuration['include_path']) . PATH_SEPARATOR . ini_get('include_path'));
}
foreach ($configuration['ini'] as $name => $value) {
if (defined($value)) {
$value = constant($value);
}
ini_set($name, $value);
}
foreach ($configuration['const'] as $name => $value) {
if (!defined($name)) {
define($name, $value);
}
}
foreach (array(
'var',
'post',
'get',
'cookie',
'server',
'files',
'request',
) as $array) {
// See https://github.com/sebastianbergmann/phpunit/issues/277
switch ($array) {
case 'var':
$target =& $GLOBALS;
break;
case 'server':
$target =& $_SERVER;
break;
default:
$target =& $GLOBALS['_' . strtoupper($array)];
break;
}
foreach ($configuration[$array] as $name => $value) {
$target[$name] = $value;
}
}
foreach ($configuration['env'] as $name => $value) {
if (false === getenv($name)) {
putenv("{$name}={$value}");
}
if (!isset($_ENV[$name])) {
$_ENV[$name] = $value;
}
}
}