X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FExtraParserTest.php;h=fc317b719804e66e439a47e368931e0529150772;hb=4077b57759756ecd0d25427ec9598feb28a28ac1;hp=7ce4d1efc6a7afab633e00fd48ff2b33c5f0ba45;hpb=1c9664d18a698f0bc28cd01de9460ebb07b900c4;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 7ce4d1efc6..fc317b7198 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -46,6 +46,25 @@ class ExtraParserTest extends MediaWikiTestCase { $this->parser->parse( $longLine, $title, $options )->getText( [ 'unwrap' => true ] ) ); } + /** + * @covers Parser::braceSubstitution + * @covers SpecialPageFactory::capturePath + */ + public function testSpecialPageTransclusionRestoresGlobalState() { + $text = "{{Special:ApiHelp/help}}"; + $title = Title::newFromText( 'testSpecialPageTransclusionRestoresGlobalState' ); + $options = ParserOptions::newFromUser( new User() ); + + RequestContext::getMain()->setTitle( $title ); + RequestContext::getMain()->getWikiPage()->CustomTestProp = true; + + $parsed = $this->parser->parse( $text, $title, $options )->getText(); + $this->assertContains( 'apihelp-header', $parsed ); + + // Verify that this property wasn't wiped out by the parse + $this->assertTrue( RequestContext::getMain()->getWikiPage()->CustomTestProp ); + } + /** * Test the parser entry points * @covers Parser::parse