Merge "Change .tocnumber to use grey text for section numbers in Table of Contents...
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index 4ef778d..e433c2e 100644 (file)
@@ -26,6 +26,7 @@
  * @ingroup Testing
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\ScopedCallback;
 
 /**
  * @ingroup Testing
@@ -49,7 +50,7 @@ class ParserTestRunner {
 
        /**
         * Our connection to the database
-        * @var DatabaseBase
+        * @var Database
         */
        private $db;
 
@@ -59,11 +60,6 @@ class ParserTestRunner {
         */
        private $dbClone;
 
-       /**
-        * @var DjVuSupport
-        */
-       private $djVuSupport;
-
        /**
         * @var TidySupport
         */
@@ -138,7 +134,6 @@ class ParserTestRunner {
                $this->runDisabled = !empty( $options['run-disabled'] );
                $this->runParsoid = !empty( $options['run-parsoid'] );
 
-               $this->djVuSupport = new DjVuSupport();
                $this->tidySupport = new TidySupport( !empty( $options['use-tidy-config'] ) );
                if ( !$this->tidySupport->isEnabled() ) {
                        $this->recorder->warning(
@@ -181,7 +176,7 @@ class ParserTestRunner {
                // arrays: $setup and $teardown. The code snippets in the $setup array
                // are executed at the end of the method, before it returns, and the
                // code snippets in the $teardown array are executed in reverse order
-               // when the ScopedCallback object is consumed.
+               // when the Wikimedia\ScopedCallback object is consumed.
 
                // Because it is a common operation to save, set and restore global
                // variables, we have an additional convention: when the array key of
@@ -348,7 +343,8 @@ class ParserTestRunner {
                        $backend = new FSFileBackend( [
                                'name' => 'local-backend',
                                'wikiId' => wfWikiID(),
-                               'basePath' => $this->uploadDir
+                               'basePath' => $this->uploadDir,
+                               'tmpDirectory' => wfTempDir()
                        ] );
                } elseif ( $this->fileBackendName ) {
                        global $wgFileBackends;
@@ -379,7 +375,7 @@ class ParserTestRunner {
 
                return new RepoGroup(
                        [
-                               'class' => 'LocalRepo',
+                               'class' => 'MockLocalRepo',
                                'name' => 'local',
                                'url' => 'http://example.com/images',
                                'hashLevels' => 2,
@@ -455,7 +451,6 @@ class ParserTestRunner {
                }
                $this->setupDone[$funcName] = true;
                return function () use ( $funcName ) {
-                       wfDebug( "markSetupDone unmarked $funcName" );
                        $this->setupDone[$funcName] = false;
                };
        }
@@ -751,14 +746,6 @@ class ParserTestRunner {
                $user = $context->getUser();
                $options = ParserOptions::newFromContext( $context );
 
-               if ( isset( $opts['djvu'] ) ) {
-                       if ( !$this->djVuSupport->isEnabled() ) {
-                               $this->recorder->skipped( $test,
-                                       'djvu binaries do not exist or are not executable' );
-                               return false;
-                       }
-               }
-
                if ( isset( $opts['tidy'] ) ) {
                        if ( !$this->tidySupport->isEnabled() ) {
                                $this->recorder->skipped( $test, 'tidy extension is not installed' );
@@ -1027,7 +1014,6 @@ class ParserTestRunner {
                };
 
                // Set content language. This invalidates the magic word cache and title services
-               wfDebug( "Setting up language $langCode" );
                $lang = Language::factory( $langCode );
                $setup['wgContLang'] = $lang;
                $reset = function () {
@@ -1523,7 +1509,7 @@ class ParserTestRunner {
                }
 
                // The RepoGroup cache is invalidated by the creation of file redirects
-               if ( $title->getNamespace() === NS_IMAGE ) {
+               if ( $title->inNamespace( NS_FILE ) ) {
                        RepoGroup::singleton()->clearCache( $title );
                }
        }