Merge "createNoOpMock() method for PHPUnit tests"
[lhc/web/wiklou.git] / tests / phpunit / bootstrap.php
index 10348d4..f227ae1 100644 (file)
@@ -49,13 +49,18 @@ function wfRequireOnceInGlobalScope( $fileName ) {
 define( 'MEDIAWIKI', true );
 define( 'MW_PHPUNIT_TEST', true );
 
-// We don't use a settings file here but some code still assumes that one exists
-define( 'MW_CONFIG_FILE', 'LocalSettings.php' );
-
 $IP = realpath( __DIR__ . '/../../' );
+// We don't use a settings file here but some code still assumes that one exists
+define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
 
 // 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;
@@ -67,6 +72,7 @@ wfRequireOnceInGlobalScope( "$IP/includes/AutoLoader.php" );
 wfRequireOnceInGlobalScope( "$IP/tests/common/TestsAutoLoader.php" );
 wfRequireOnceInGlobalScope( "$IP/includes/Defines.php" );
 wfRequireOnceInGlobalScope( "$IP/includes/DefaultSettings.php" );
+wfRequireOnceInGlobalScope( "$IP/includes/GlobalFunctions.php" );
 
 // Load extensions/skins present in filesystem so that classes can be discovered.
 $directoryToJsonMap = [