Merge "Show redirect fragments on Special:ListRedirects"
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index 9255733..e578418 100644 (file)
@@ -168,7 +168,7 @@ class ParserTestRunner {
                global $wgParserTestFiles;
 
                // Add core test files
-               $files = array_map( function( $item ) {
+               $files = array_map( function ( $item ) {
                        return __DIR__ . "/$item";
                }, self::$coreTestFiles );
 
@@ -1036,6 +1036,9 @@ class ParserTestRunner {
                $linkHolderBatchSize =
                        self::getOptionValue( 'wgLinkHolderBatchSize', $opts, 1000 );
 
+               // Default to fallback skin, but allow it to be overridden
+               $skin = self::getOptionValue( 'skin', $opts, 'fallback' );
+
                $setup = [
                        'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ),
                        'wgLanguageCode' => $langCode,
@@ -1052,6 +1055,8 @@ class ParserTestRunner {
                        // wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
                        'wgEnableMagicLinks' => self::getOptionValue( 'wgEnableMagicLinks', $opts, [] )
                                + [ 'ISBN' => true, 'PMID' => true, 'RFC' => true ],
+                       // Test with legacy encoding by default until HTML5 is very stable and default
+                       'wgFragmentMode' => [ 'legacy' ],
                ];
 
                if ( $config ) {
@@ -1105,7 +1110,13 @@ class ParserTestRunner {
                $context = RequestContext::getMain();
                $context->setUser( $user );
                $context->setLanguage( $lang );
-               $teardown[] = function () use ( $context ) {
+               // And the skin!
+               $oldSkin = $context->getSkin();
+               $skinFactory = MediaWikiServices::getInstance()->getSkinFactory();
+               $context->setSkin( $skinFactory->makeSkin( $skin ) );
+               $context->setOutput( new OutputPage( $context ) );
+               $setup['wgOut'] = $context->getOutput();
+               $teardown[] = function () use ( $context, $oldSkin ) {
                        // Clear language conversion tables
                        $wrapper = TestingAccessWrapper::newFromObject(
                                $context->getLanguage()->getConverter()
@@ -1114,6 +1125,8 @@ class ParserTestRunner {
                        // Reset context to the restored globals
                        $context->setUser( $GLOBALS['wgUser'] );
                        $context->setLanguage( $GLOBALS['wgContLang'] );
+                       $context->setSkin( $oldSkin );
+                       $context->setOutput( $GLOBALS['wgOut'] );
                };
 
                $teardown[] = $this->executeSetupSnippets( $setup );