X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fcommon%2FTestSetup.php;h=141e307fbe4e911991937816db9bf48b23d85011;hb=72e141a5e33417a3f4bcb18cf8a862634bda9bee;hp=d4df8ae5eebceec3248bf3c3b4b90e62c4b85b65;hpb=45cf5258871867a159c264983e8dc60ed083d9fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/common/TestSetup.php b/tests/common/TestSetup.php index d4df8ae5ee..141e307fbe 100644 --- a/tests/common/TestSetup.php +++ b/tests/common/TestSetup.php @@ -4,6 +4,23 @@ * Common code for test environment initialisation and teardown */ class TestSetup { + public static $bootstrapGlobals; + + /** + * For use in MediaWikiUnitTestCase. + * + * This should be called before DefaultSettings.php or Setup.php loads. + */ + public static function snapshotGlobals() { + self::$bootstrapGlobals = []; + foreach ( $GLOBALS as $key => $_ ) { + // Support: HHVM (avoid self-ref) + if ( $key !== 'GLOBALS' ) { + self::$bootstrapGlobals[ $key ] =& $GLOBALS[$key]; + } + } + } + /** * This should be called before Setup.php, e.g. from the finalSetup() method * of a Maintenance subclass