public static function PHPUnit_Util_GlobalState::getGlobalsAsString

1 call to PHPUnit_Util_GlobalState::getGlobalsAsString()
PHPUnit_Framework_TestCase::run in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php
Runs the test case and collects the results in a TestResult object. If no TestResult object is passed a new one will be created.

File

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

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 getGlobalsAsString() {
  $result = '';
  $superGlobalArrays = self::getSuperGlobalArrays();
  foreach ($superGlobalArrays as $superGlobalArray) {
    if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) {
      foreach (array_keys($GLOBALS[$superGlobalArray]) as $key) {
        if ($GLOBALS[$superGlobalArray][$key] instanceof Closure) {
          continue;
        }
        $result .= sprintf('$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n", $superGlobalArray, $key, self::exportVariable($GLOBALS[$superGlobalArray][$key]));
      }
    }
  }
  $blacklist = $superGlobalArrays;
  $blacklist[] = 'GLOBALS';
  $blacklist[] = '_PEAR_Config_instance';
  foreach (array_keys($GLOBALS) as $key) {
    if (!in_array($key, $blacklist) && !$GLOBALS[$key] instanceof Closure) {
      $result .= sprintf('$GLOBALS[\'%s\'] = %s;' . "\n", $key, self::exportVariable($GLOBALS[$key]));
    }
  }
  return $result;
}