Merge "Exclude redirects from Special:Fewestrevisions"
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiUnitTestCase.php
index 3f0fc7a..5f7746b 100644 (file)
@@ -36,7 +36,8 @@ abstract class MediaWikiUnitTestCase extends TestCase {
        protected function setUp() {
                parent::setUp();
                $reflection = new ReflectionClass( $this );
-               if ( strpos( $reflection->getFilename(), '/unit/' ) === false ) {
+               $dirSeparator = DIRECTORY_SEPARATOR;
+               if ( strpos( $reflection->getFilename(), "${dirSeparator}unit${dirSeparator}" ) === false ) {
                        $this->fail( 'This unit test needs to be in "tests/phpunit/unit" !' );
                }
                $this->unitGlobals = $GLOBALS;
@@ -44,8 +45,8 @@ abstract class MediaWikiUnitTestCase extends TestCase {
                $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 ];
                }
        }