X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fparser%2FTagHooksTest.php;h=06da7a53f709964064d8b58b3e7d191675406fab;hb=414215ccac0f3288ccb1a40a5a8e29b9a70f0e89;hp=7e31cba60fc671b21fcb0419b2d988da905c05bb;hpb=236488d398046838059f758b0915341648b64c7b;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/parser/TagHooksTest.php b/tests/phpunit/includes/parser/TagHooksTest.php index 7e31cba60f..06da7a53f7 100644 --- a/tests/phpunit/includes/parser/TagHooksTest.php +++ b/tests/phpunit/includes/parser/TagHooksTest.php @@ -1,10 +1,13 @@ setWrapOutputClass( false ); + $popt = ParserOptions::newFromUserAndLang( new User, + MediaWikiServices::getInstance()->getContentLanguage() ); return $popt; } @@ -54,8 +56,7 @@ class TagHooksTest extends MediaWikiTestCase { * @dataProvider provideValidNames */ public function testTagHooks( $tag ) { - global $wgParserConf; - $parser = new Parser( $wgParserConf ); + $parser = MediaWikiServices::getInstance()->getParserFactory()->create(); $parser->setHook( $tag, [ $this, 'tagCallback' ] ); $parserOutput = $parser->parse( @@ -63,7 +64,7 @@ class TagHooksTest extends MediaWikiTestCase { Title::newFromText( 'Test' ), $this->getParserOptions() ); - $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText() ); + $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText( [ 'unwrap' => true ] ) ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle } @@ -73,8 +74,7 @@ class TagHooksTest extends MediaWikiTestCase { * @expectedException MWException */ public function testBadTagHooks( $tag ) { - global $wgParserConf; - $parser = new Parser( $wgParserConf ); + $parser = MediaWikiServices::getInstance()->getParserFactory()->create(); $parser->setHook( $tag, [ $this, 'tagCallback' ] ); $parser->parse( @@ -89,8 +89,7 @@ class TagHooksTest extends MediaWikiTestCase { * @dataProvider provideValidNames */ public function testFunctionTagHooks( $tag ) { - global $wgParserConf; - $parser = new Parser( $wgParserConf ); + $parser = MediaWikiServices::getInstance()->getParserFactory()->create(); $parser->setFunctionTagHook( $tag, [ $this, 'functionTagCallback' ], 0 ); $parserOutput = $parser->parse( @@ -98,7 +97,7 @@ class TagHooksTest extends MediaWikiTestCase { Title::newFromText( 'Test' ), $this->getParserOptions() ); - $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText() ); + $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText( [ 'unwrap' => true ] ) ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle } @@ -108,8 +107,7 @@ class TagHooksTest extends MediaWikiTestCase { * @expectedException MWException */ public function testBadFunctionTagHooks( $tag ) { - global $wgParserConf; - $parser = new Parser( $wgParserConf ); + $parser = MediaWikiServices::getInstance()->getParserFactory()->create(); $parser->setFunctionTagHook( $tag,