public static function PHPUnit_Util_GlobalState::restoreGlobals

1 call to PHPUnit_Util_GlobalState::restoreGlobals()
PHPUnit_Framework_TestCase::runBare in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php
Runs the bare test sequence.

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/GlobalState.php, line 120

Class

PHPUnit_Util_GlobalState
@package PHPUnit @subpackage Util @author Sebastian Bergmann <sebastian@phpunit.de> @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de> @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause…

Code

public static function restoreGlobals(array $blacklist) {
  if (ini_get('register_long_arrays') == '1') {
    $superGlobalArrays = array_merge(self::$superGlobalArrays, self::$superGlobalArraysLong);
  }
  else {
    $superGlobalArrays = self::$superGlobalArrays;
  }
  foreach ($superGlobalArrays as $superGlobalArray) {
    if (!in_array($superGlobalArray, $blacklist)) {
      self::restoreSuperGlobalArray($superGlobalArray);
    }
  }
  foreach (array_keys($GLOBALS) as $key) {
    if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && !in_array($key, $blacklist)) {
      if (isset(self::$globals['GLOBALS'][$key])) {
        $GLOBALS[$key] = unserialize(self::$globals['GLOBALS'][$key]);
      }
      else {
        unset($GLOBALS[$key]);
      }
    }
  }
  self::$globals = array();
}