Don't use deprecated $wgParserConf global

The modern way to create a Parser object is to use a ParserFactory.

Change-Id: I97d58750c91b06eeca5d810509becdf53a39cc95
This commit is contained in:
C. Scott Ananian 2020-04-16 14:38:36 -04:00
parent 8f9bb5d11e
commit eb0babef80

View file

@ -1,5 +1,7 @@
<?php
use MediaWiki\MediaWikiServices;
/**
* @group TemplateStyles
* @group Database
@ -154,8 +156,6 @@ class TemplateStylesHooksTest extends MediaWikiLangTestCase {
public function testTag(
ParserOptions $popt, $getTextOptions, $wikitext, $expect, $globals = []
) {
global $wgParserConf;
$this->setMwGlobals( $globals + [
'wgScriptPath' => '',
'wgScript' => '/index.php',
@ -179,9 +179,8 @@ class TemplateStylesHooksTest extends MediaWikiLangTestCase {
}
);
$class = $wgParserConf['class'];
$parser = new $class( $wgParserConf );
/** @var Parser $parser */
$services = MediaWikiServices::getInstance();
$parser = $services->getParserFactory()->create();
$parser->firstCallInit();
if ( !isset( $parser->mTagHooks['templatestyles'] ) ) {
throw new Exception( 'templatestyles tag hook is not in the parser' );