Permalink
Browse files

- Merge [5049].

  • Loading branch information...
1 parent 2c677e6 commit b7c5e27d9d8e0c939c47ae27661e4bc746980da9 @sebastianbergmann committed Jul 31, 2009
@@ -18,6 +18,7 @@ function __phpunit_run_isolated_test()
);
}
+{constants}
{globals}
set_include_path('{include_path}');
@@ -567,6 +567,7 @@ public function run(PHPUnit_Framework_TestResult $result = NULL)
'dependencyInput' => addcslashes(serialize($this->dependencyInput), "'"),
'dataName' => $this->dataName,
'collectCodeCoverageInformation' => $collectCodeCoverageInformation ? 'TRUE' : 'FALSE',
+ 'constants' => PHPUnit_Util_GlobalState::getConstantsAsString(),
'globals' => PHPUnit_Util_GlobalState::getGlobalsAsString(),
'include_path' => addslashes(get_include_path())
)
@@ -170,6 +170,25 @@ protected static function restoreSuperGlobalArray($superGlobalArray)
self::$globals[$superGlobalArray] = array();
}
+ public static function getConstantsAsString()
+ {
+ $constants = get_defined_constants(TRUE);
+ $result = '';
+
+ if (isset($constants['user'])) {
+ foreach ($constants['user'] as $name => $value) {
+ $result .= sprintf(
+ 'if (!defined(\'%s\')) define(\'%s\', %s);' . "\n",
+ $name,
+ $name,
+ var_export($value, TRUE)
+ );
+ }
+ }
+
+ return $result;
+ }
+
public static function getGlobalsAsString()
{
$result = '';

0 comments on commit b7c5e27

Please sign in to comment.