$setup['wgHtml5'] = true;
$setup['wgDisableLangConversion'] = false;
$setup['wgDisableTitleConversion'] = false;
- $setup['wgMediaInTargetLanguage'] = false;
// "extra language links"
// see https://gerrit.wikimedia.org/r/111390
100 => 'MemoryAlpha',
101 => 'MemoryAlpha_talk'
];
- // Changing wgExtraNamespaces invalidates caches in MWNamespace and
- // any live Language object, both on setup and teardown
+ // Changing wgExtraNamespaces invalidates caches in NamespaceInfo and any live Language
+ // object, both on setup and teardown
$reset = function () {
- MWNamespace::clearCaches();
+ MediaWikiServices::getInstance()->resetServiceForTesting( 'NamespaceInfo' );
MediaWikiServices::getInstance()->getContentLanguage()->resetNamespaces();
};
$setup[] = $reset;
*/
private static function getOptionValue( $key, $opts, $default ) {
$key = strtolower( $key );
-
- if ( isset( $opts[$key] ) ) {
- return $opts[$key];
- } else {
- return $default;
- }
+ return $opts[$key] ?? $default;
}
/**
+ [ 'ISBN' => true, 'PMID' => true, 'RFC' => true ],
// Test with legacy encoding by default until HTML5 is very stable and default
'wgFragmentMode' => [ 'legacy' ],
- 'wgMediaInTargetLanguage' => self::getOptionValue( 'wgMediaInTargetLanguage', $opts, false ),
];
$nonIncludable = self::getOptionValue( 'wgNonincludableNamespaces', $opts, false );
* @return bool True if tag hook is present
*/
public function requireHook( $name ) {
- global $wgParser;
+ $parser = MediaWikiServices::getInstance()->getParser();
- $wgParser->firstCallInit(); // make sure hooks are loaded.
- if ( isset( $wgParser->mTagHooks[$name] ) ) {
+ $parser->firstCallInit(); // make sure hooks are loaded.
+ if ( isset( $parser->mTagHooks[$name] ) ) {
return true;
} else {
$this->recorder->warning( " This test suite requires the '$name' hook " .
* @return bool True if function hook is present
*/
public function requireFunctionHook( $name ) {
- global $wgParser;
+ $parser = MediaWikiServices::getInstance()->getParser();
- $wgParser->firstCallInit(); // make sure hooks are loaded.
+ $parser->firstCallInit(); // make sure hooks are loaded.
- if ( isset( $wgParser->mFunctionHooks[$name] ) ) {
+ if ( isset( $parser->mFunctionHooks[$name] ) ) {
return true;
} else {
$this->recorder->warning( " This test suite requires the '$name' function " .
* @return bool True if function hook is present
*/
public function requireTransparentHook( $name ) {
- global $wgParser;
+ $parser = MediaWikiServices::getInstance()->getParser();
- $wgParser->firstCallInit(); // make sure hooks are loaded.
+ $parser->firstCallInit(); // make sure hooks are loaded.
- if ( isset( $wgParser->mTransparentTagHooks[$name] ) ) {
+ if ( isset( $parser->mTransparentTagHooks[$name] ) ) {
return true;
} else {
$this->recorder->warning( " This test suite requires the '$name' transparent " .