Merge "Support GENDER in MediaWiki:Blockip and Special:Block"
[lhc/web/wiklou.git] / tests / parser / parserTest.inc
index 24c5aba..e76b9df 100644 (file)
@@ -148,7 +148,7 @@ class ParserTest {
                global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc,
                        $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
                        $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
-                       $wgExtraInterlanguageLinkPrefixes,
+                       $wgExtraInterlanguageLinkPrefixes, $wgLocalInterwikis,
                        $parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
                        $wgArticlePath, $wgScript, $wgStylePath, $wgExtensionAssetsPath,
                        $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgLockManagers;
@@ -208,7 +208,6 @@ class ParserTest {
                $messageMemc = wfGetMessageCacheStorage();
                $parserMemc = wfGetParserCacheStorage();
 
-               // $wgContLang = new StubContLang;
                $wgUser = new User;
                $context = new RequestContext;
                $wgLang = $context->getLanguage();
@@ -219,11 +218,12 @@ class ParserTest {
                if ( $wgStyleDirectory === false ) {
                        $wgStyleDirectory = "$IP/skins";
                }
+
+               self::setupInterwikis();
+               $wgLocalInterwikis = array( 'local', 'mi' );
                // "extra language links"
                // see https://gerrit.wikimedia.org/r/111390
                array_push( $wgExtraInterlanguageLinkPrefixes, 'mul' );
-
-               self::setupInterwikis();
        }
 
        /**
@@ -240,6 +240,11 @@ class ParserTest {
                # for testing inter-language links
                Hooks::register( 'InterwikiLoadPrefix', function ( $prefix, &$iwData ) {
                        static $testInterwikis = array(
+                               'local' => array(
+                                       'iw_url' => 'http://doesnt.matter.org/$1',
+                                       'iw_api' => '',
+                                       'iw_wikiid' => '',
+                                       'iw_local' => 0 ),
                                'wikipedia' => array(
                                        'iw_url' => 'http://en.wikipedia.org/wiki/$1',
                                        'iw_api' => '',
@@ -275,6 +280,11 @@ class ParserTest {
                                        'iw_api' => '',
                                        'iw_wikiid' => '',
                                        'iw_local' => 1 ),
+                               'mi' => array(
+                                       'iw_url' => 'http://mi.wikipedia.org/wiki/$1',
+                                       'iw_api' => '',
+                                       'iw_wikiid' => '',
+                                       'iw_local' => 1 ),
                                'mul' => array(
                                        'iw_url' => 'http://wikisource.org/wiki/$1',
                                        'iw_api' => '',
@@ -723,11 +733,11 @@ class ParserTest {
 
                if ( preg_match_all( $regex, $instring, $matches, PREG_SET_ORDER ) ) {
                        foreach ( $matches as $bits ) {
-                               $key = strtolower( $bits[ 'k' ] );
-                               if ( !isset( $bits[ 'v' ] ) ) {
+                               $key = strtolower( $bits['k'] );
+                               if ( !isset( $bits['v'] ) ) {
                                        $opts[$key] = true;
                                } else {
-                                       preg_match_all( $valueregex, $bits[ 'v' ], $vmatches );
+                                       preg_match_all( $valueregex, $bits['v'], $vmatches );
                                        $opts[$key] = array_map( array( $this, 'cleanupOption' ), $vmatches[0] );
                                        if ( count( $opts[$key] ) == 1 ) {
                                                $opts[$key] = $opts[$key][0];