$GLOBALS = [];
// Add back the minimal set of globals needed for unit tests to run for core +
// extensions/skins.
- foreach ( [ 'wgAutoloadClasses', 'wgAutoloadLocalClasses', 'IP' ] as $requiredGlobal ) {
- $GLOBALS[$requiredGlobal] = $this->unitGlobals[ $requiredGlobal ];
+ foreach ( $this->unitGlobals['wgPhpUnitBootstrapGlobals'] ?? [] as $key => $value ) {
+ $GLOBALS[ $key ] = $this->unitGlobals[ $key ];
}
}
// these variables must be defined before setup runs
$GLOBALS['IP'] = $IP;
+// Set bootstrap globals to reuse in MediaWikiUnitTestCase
+$bootstrapGlobals = [];
+foreach ( $GLOBALS as $key => $value ) {
+ $bootstrapGlobals[ $key ] = $value;
+}
+$GLOBALS['wgPhpUnitBootstrapGlobals'] = $bootstrapGlobals;
// Faking for Setup.php
$GLOBALS['wgScopeTest'] = 'MediaWiki Setup.php scope test';
$GLOBALS['wgCommandLineMode'] = true;