X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fbootstrap.php;h=477dbd298eec301df505af066e098685a361739c;hb=02210976ab8a2d865c53df85dfb21dae2f0d709b;hp=f227ae162629c45f488eacb0caabce575daba499;hpb=529143e4aa1bf708bb749857c2e03358ee67fe65;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index f227ae1626..477dbd298e 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -55,35 +55,34 @@ 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 + +require_once "$IP/tests/common/TestSetup.php"; +TestSetup::snapshotGlobals(); + +// Faking in lieu of Setup.php $GLOBALS['wgScopeTest'] = 'MediaWiki Setup.php scope test'; $GLOBALS['wgCommandLineMode'] = true; $GLOBALS['wgAutoloadClasses'] = []; -require_once "$IP/tests/common/TestSetup.php"; - 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. +// Populate classes and namespaces from extensions and skins present in filesystem. $directoryToJsonMap = [ - 'extensions' => [ 'extension.json', 'extension-wip.json' ], - 'skins' => [ 'skin.json', 'skin-wip.json' ] + $GLOBALS['wgExtensionDirectory'] => [ 'extension.json', 'extension-wip.json' ], + $GLOBALS['wgStyleDirectory'] => [ 'skin.json', 'skin-wip.json' ] ]; foreach ( $directoryToJsonMap as $directory => $jsonFile ) { - foreach ( new DirectoryIterator( __DIR__ . '/../../' . $directory ) as $iterator ) { + foreach ( new DirectoryIterator( $directory ) as $iterator ) { foreach ( $jsonFile as $file ) { + $jsonPath = $iterator->getPathname() . '/' . $file; if ( file_exists( $jsonPath ) ) { + // ExtensionRegistry->readFromQueue is not used as it checks extension/skin + // dependencies, which we don't need or want for unit tests. $json = file_get_contents( $jsonPath ); $info = json_decode( $json, true ); $dir = dirname( $jsonPath );