public function PHPUnit_Util_Configuration::handlePHPConfiguration

Handles the PHP configuration.

@since Method available since Release 3.2.20

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php, line 510

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',
    'env',
    'post',
    'get',
    'cookie',
    'server',
    'files',
    'request',
  ) as $array) {

    // See https://github.com/sebastianbergmann/phpunit/issues/277
    switch ($array) {
      case 'var':
        $target =& $GLOBALS;
        break;
      case 'env':
        $target =& $_ENV;
        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) {
    putenv("{$name}={$value}");
  }
}