Set wgCommentTableSchemaMigrationStage for some RevisionTests
[lhc/web/wiklou.git] / tests / phpunit / includes / MessageTest.php
index 424218e..912bffe 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class MessageTest extends MediaWikiLangTestCase {
 
        protected function setUp() {
@@ -394,6 +396,22 @@ class MessageTest extends MediaWikiLangTestCase {
                $this->assertSame( 'example &amp;', $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( '<html><script>alert("xss")</script></html>' );
+               $txt = '<span class="error">&lt;html&gt; tags cannot be' .
+                       ' used outside of normal pages.</span>';
+               $this->assertSame( $txt, $msg->parse() );
+       }
+
        /**
         * @covers Message::params
         * @covers Message::toString