Remove support for $wgWellFormedXml=false
[lhc/web/wiklou.git] / tests / parser / parserTest.inc
index 15f2dcf..1be2d62 100644 (file)
@@ -27,6 +27,7 @@
  * @file
  * @ingroup Testing
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * @ingroup Testing
@@ -210,6 +211,7 @@ class ParserTest {
                # add a namespace shadowing a interwiki link, to test
                # proper precedence when resolving links. (bug 51680)
                $wgExtraNamespaces[100] = 'MemoryAlpha';
+               $wgExtraNamespaces[101] = 'MemoryAlpha talk';
 
                // XXX: tests won't run without this (for CACHE_DB)
                if ( $wgMainCacheType === CACHE_DB ) {
@@ -244,6 +246,10 @@ class ParserTest {
                // "extra language links"
                // see https://gerrit.wikimedia.org/r/111390
                array_push( $wgExtraInterlanguageLinkPrefixes, 'mul' );
+
+               // Reset namespace cache
+               MWNamespace::getCanonicalNamespaces( true );
+               Language::factory( 'en' )->resetNamespaces();
        }
 
        /**
@@ -327,6 +333,18 @@ class ParserTest {
                Hooks::clear( 'InterwikiLoadPrefix' );
        }
 
+       /**
+        * Reset the Title-related services that need resetting
+        * for each test
+        */
+       public static function resetTitleServices() {
+               $services = MediaWikiServices::getInstance();
+               $services->resetServiceForTesting( 'TitleFormatter' );
+               $services->resetServiceForTesting( 'TitleParser' );
+               $services->resetServiceForTesting( '_MediaWikiTitleCodec' );
+
+       }
+
        public function setupRecorder( $options ) {
                if ( isset( $options['record'] ) ) {
                        $this->recorder = new DbTestRecorder( $this );
@@ -536,7 +554,7 @@ class ParserTest {
                        $result =
                                $this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] );
                        $ok = $ok && $result;
-                       $this->recorder->record( $t['test'], $result );
+                       $this->recorder->record( $t['test'], $t['subtest'], $result );
                }
 
                if ( $this->showProgress ) {
@@ -619,6 +637,7 @@ class ParserTest {
                        $titleText = 'Parser test';
                }
 
+               ObjectCache::getMainWANInstance()->clearProcessCache();
                $local = isset( $opts['local'] );
                $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
                $parser = $this->getParser( $preprocessor );
@@ -895,7 +914,6 @@ class ParserTest {
                        'wgExperimentalHtmlIds' => false,
                        'wgExternalLinkTarget' => false,
                        'wgHtml5' => true,
-                       'wgWellFormedXml' => true,
                        'wgAdaptiveMessageCache' => true,
                        'wgDisableLangConversion' => false,
                        'wgDisableTitleConversion' => false,
@@ -953,6 +971,8 @@ class ParserTest {
                MWTidy::destroySingleton();
                RepoGroup::destroySingleton();
 
+               self::resetTitleServices();
+
                return $context;
        }