X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FParserTestRunner.php;h=3eb25a9c95d5926e493390d7b9916420717e9ac5;hb=86c13ba3ad15f7ab4c567b30c2810fe36db102df;hp=699de951b6020a0744eae240fbd42db03fb86494;hpb=a73428bb88345af4a80e5edbf1357fbc0f6054c1;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 699de951b6..3eb25a9c95 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -388,10 +388,10 @@ class ParserTestRunner { 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; @@ -938,12 +938,7 @@ class ParserTestRunner { */ private static function getOptionValue( $key, $opts, $default ) { $key = strtolower( $key ); - - if ( isset( $opts[$key] ) ) { - return $opts[$key]; - } else { - return $default; - } + return $opts[$key] ?? $default; } /** @@ -1724,10 +1719,10 @@ class ParserTestRunner { * @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 " . @@ -1743,11 +1738,11 @@ class ParserTestRunner { * @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 " . @@ -1763,11 +1758,11 @@ class ParserTestRunner { * @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 " .