X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMessageTest.php;h=912bffe6459a49e060d83284f30f46766273075d;hb=2ffff73a46c29cdad1cbf59063f4dd75debd3b4c;hp=2694b850a00530fb75b04c84aa83774427c21c89;hpb=56d4bb139015c5dc609234f70895a5f6834a17b6;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php index 2694b850a0..912bffe645 100644 --- a/tests/phpunit/includes/MessageTest.php +++ b/tests/phpunit/includes/MessageTest.php @@ -1,5 +1,7 @@ foo', 'parse', 'foo', 'foo' ], [ 'foo', 'escaped', '<span>foo</span>', - 'foo' ], + 'foo' ], [ 'foo', 'plain', 'foo', 'foo' ], [ '', 'parse', '<script>alert(1)</script>', '<script>alert(1)</script>' ], [ '', 'escaped', '<script>alert(1)</script>', '<script>alert(1)</script>' ], [ '', 'plain', '', - '<script>alert(1)</script>' ], + '<script>alert(1)</script>' ], ]; } @@ -394,6 +396,22 @@ class MessageTest extends MediaWikiLangTestCase { $this->assertSame( 'example &', $msg->escaped() ); } + public function testRawHtmlInMsg() { + global $wgParserConf; + $this->setMwGlobals( 'wgRawHtml', true ); + // We have to reset the core hook registration. + // to register the html hook + MessageCache::destroyInstance(); + $this->setMwGlobals( 'wgParser', + ObjectFactory::constructClassInstance( $wgParserConf['class'], [ $wgParserConf ] ) + ); + + $msg = new RawMessage( '' ); + $txt = '<html> tags cannot be' . + ' used outside of normal pages.'; + $this->assertSame( $txt, $msg->parse() ); + } + /** * @covers Message::params * @covers Message::toString