*/
private $djVuSupport;
- /**
- * @var string $oldTablePrefix Original table prefix
- */
- private $oldTablePrefix;
-
private $maxFuzzTestLength = 300;
private $fuzzSeed = 0;
private $memoryLimit = 50;
$this->hooks = array();
$this->functionHooks = array();
+ $this->transparentHooks = array();
self::setUp();
}
global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc,
$wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
$wgExtraNamespaces, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
+ $wgExtraInterlanguageLinkPrefixes, $wgLocalInterwikis,
$parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
$wgArticlePath, $wgScript, $wgStylePath, $wgExtensionAssetsPath,
$wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgLockManagers;
$messageMemc = wfGetMessageCacheStorage();
$parserMemc = wfGetParserCacheStorage();
- // $wgContLang = new StubContLang;
$wgUser = new User;
$context = new RequestContext;
$wgLang = $context->getLanguage();
}
self::setupInterwikis();
+ $wgLocalInterwikis = array( 'local', 'mi' );
+ // "extra language links"
+ // see https://gerrit.wikimedia.org/r/111390
+ array_push( $wgExtraInterlanguageLinkPrefixes, 'mul' );
}
/**
# 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' => '',
'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' => '',
+ 'iw_wikiid' => '',
+ 'iw_local' => 1 ),
);
if ( array_key_exists( $prefix, $testInterwikis ) ) {
$iwData = $testInterwikis[$prefix];
$parser->setFunctionHook( $tag, $callback, $flags );
}
+ foreach ( $this->transparentHooks as $tag => $callback ) {
+ $parser->setTransparentTagHook( $tag, $callback );
+ }
+
wfRunHooks( 'ParserTestParser', array( &$parser ) );
return $parser;
}
$this->databaseSetupDone = true;
- $this->oldTablePrefix = $wgDBprefix;
# SqlBagOStuff broke when using temporary tables on r40209 (bug 15892).
# It seems to have been fixed since (r55079?), but regressed at some point before r85701.
return true;
}
+ /**
+ * Steal a callback function from the primary parser, save it for
+ * application to our scary parser. If the hook is not installed,
+ * abort processing of this file.
+ *
+ * @param string $name
+ * @return bool True if function hook is present
+ */
+ public function requireTransparentHook( $name ) {
+ global $wgParser;
+
+ $wgParser->firstCallInit(); // make sure hooks are loaded.
+
+ if ( isset( $wgParser->mTransparentTagHooks[$name] ) ) {
+ $this->transparentHooks[$name] = $wgParser->mTransparentTagHooks[$name];
+ } else {
+ echo " This test suite requires the '$name' transparent hook extension, skipping.\n";
+ return false;
+ }
+
+ return true;
+ }
+
/**
* Run the "tidy" command on text if the $wgUseTidy
* global is true