Permalink
Browse files

- Merge [3500].

  • Loading branch information...
1 parent 32787dc commit b6b06a3206efaf600576cf2eb15cd46522acd1d0 @sebastianbergmann committed Jul 22, 2008
Showing with 26 additions and 22 deletions.
  1. +26 −22 PHPUnit/Framework/TestCase.php
@@ -970,28 +970,6 @@ protected function backupGlobals()
}
}
- protected function backupSuperGlobalArray($superGlobalArray)
- {
- $this->globalsBackup[$superGlobalArray] = array();
-
- foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
- $this->globalsBackup[$superGlobalArray][$key] = serialize($value);
- }
- }
-
- protected function restoreSuperGlobalArray($superGlobalArray)
- {
- foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
- if (isset($this->globalsBackup[$superGlobalArray][$key])) {
- $GLOBALS[$superGlobalArray][$key] = unserialize($this->globalsBackup[$superGlobalArray][$key]);
- } else {
- unset($GLOBALS[$superGlobalArray][$key]);
- }
- }
-
- $this->globalsBackup[$superGlobalArray] = array();
- }
-
/**
* @since Method available since Release 3.3.0
*/
@@ -1021,6 +999,32 @@ protected function restoreGlobals()
$this->globalsBackup = array();
}
+
+ protected function backupSuperGlobalArray($superGlobalArray)
+ {
+ $this->globalsBackup[$superGlobalArray] = array();
+
+ if (isset($GLOBALS[$superGlobalArray])) {
+ foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
+ $this->globalsBackup[$superGlobalArray][$key] = serialize($value);
+ }
+ }
+ }
+
+ protected function restoreSuperGlobalArray($superGlobalArray)
+ {
+ if (isset($GLOBALS[$superGlobalArray])) {
+ foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
+ if (isset($this->globalsBackup[$superGlobalArray][$key])) {
+ $GLOBALS[$superGlobalArray][$key] = unserialize($this->globalsBackup[$superGlobalArray][$key]);
+ } else {
+ unset($GLOBALS[$superGlobalArray][$key]);
+ }
+ }
+ }
+
+ $this->globalsBackup[$superGlobalArray] = array();
+ }
}
}

0 comments on commit b6b06a3

Please sign in to comment.