Merge "SpecialMovepage: Convert form to use OOUI controls"
[lhc/web/wiklou.git] / tests / parser / parserTest.inc
index 17769ad..f429c30 100644 (file)
@@ -155,7 +155,7 @@ class ParserTest {
 
        static function setUp() {
                global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc,
-                       $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
+                       $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory,
                        $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
                        $wgExtraInterlanguageLinkPrefixes, $wgLocalInterwikis,
                        $parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
@@ -211,7 +211,6 @@ class ParserTest {
                        $wgParserCacheType = CACHE_NONE;
                }
 
-               $wgEnableParserCache = false;
                DeferredUpdates::clearPendingUpdates();
                $wgMemc = wfGetMainCache(); // checks $wgMainCacheType
                $messageMemc = wfGetMessageCacheStorage();
@@ -593,6 +592,14 @@ class ParserTest {
                        }
                }
 
+               if ( isset( $opts['tidy'] ) ) {
+                       if ( !$this->tidySupport->isEnabled() ) {
+                               return $this->showSkipped();
+                       } else {
+                               $options->setTidy( true );
+                       }
+               }
+
                if ( isset( $opts['title'] ) ) {
                        $titleText = $opts['title'];
                } else {
@@ -624,10 +631,6 @@ class ParserTest {
                        $output->setTOCEnabled( !isset( $opts['notoc'] ) );
                        $out = $output->getText();
                        if ( isset( $opts['tidy'] ) ) {
-                               if ( !$this->tidySupport->isEnabled() ) {
-                                       return $this->showSkipped();
-                               }
-                               $out = MWTidy::tidy( $out );
                                $out = preg_replace( '/\s+$/', '', $out );
                        }
 
@@ -639,6 +642,14 @@ class ParserTest {
                                $out = "$title\n$out";
                        }
 
+                       if ( isset( $opts['showindicators'] ) ) {
+                               $indicators = '';
+                               foreach ( $output->getIndicators() as $id => $content ) {
+                                       $indicators .= "$id=$content\n";
+                               }
+                               $out = $indicators . $out;
+                       }
+
                        if ( isset( $opts['ill'] ) ) {
                                $out = implode( ' ', $output->getLanguageLinks() );
                        } elseif ( isset( $opts['cat'] ) ) {
@@ -877,13 +888,10 @@ class ParserTest {
                        'wgDisableLangConversion' => false,
                        'wgDisableTitleConversion' => false,
                        // Tidy options.
-                       // We always set 'wgUseTidy' to false when parsing, but certain
-                       // test-running modes still use tidy if available, so ensure
-                       // that the tidy-related options are all set to their defaults.
-                       'wgUseTidy' => false,
-                       'wgAlwaysUseTidy' => false,
+                       'wgUseTidy' => isset( $opts['tidy'] ),
+                       'wgTidyConfig' => null,
                        'wgDebugTidy' => false,
-                       'wgTidyConf' => $IP . '/includes/tidy.conf',
+                       'wgTidyConf' => $IP . '/includes/tidy/tidy.conf',
                        'wgTidyOpts' => '',
                        'wgTidyInternal' => $this->tidySupport->isInternal(),
                );
@@ -928,6 +936,7 @@ class ParserTest {
                $wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp';
 
                MagicWord::clearCache();
+               MWTidy::destroySingleton();
 
                return $context;
        }
@@ -1210,6 +1219,7 @@ class ParserTest {
                FileBackendGroup::destroySingleton();
                LockManagerGroup::destroySingletons();
                LinkCache::singleton()->clear();
+               MWTidy::destroySingleton();
 
                foreach ( $this->savedGlobals as $var => $val ) {
                        $GLOBALS[$var] = $val;