Merge "resourceloader: Remove support for `addSource(id, url)`"
[lhc/web/wiklou.git] / tests / phpunit / includes / TitleTest.php
index d585240..f36fbfd 100644 (file)
@@ -967,4 +967,32 @@ class TitleTest extends MediaWikiTestCase {
                        [ 'zz:Foo#ั‚ะตัั‚', '#.D1.82.D0.B5.D1.81.D1.82' ],
                ];
        }
+
+       /**
+        * @covers Title::isRawHtmlMessage
+        * @dataProvider provideIsRawHtmlMessage
+        */
+       public function testIsRawHtmlMessage( $textForm, $expected ) {
+               $this->setMwGlobals( 'wgRawHtmlMessages', [
+                       'foobar',
+                       'foo_bar',
+                       'foo-bar',
+               ] );
+
+               $title = Title::newFromText( $textForm );
+               $this->assertSame( $expected, $title->isRawHtmlMessage() );
+       }
+
+       public function provideIsRawHtmlMessage() {
+               return [
+                       [ 'MediaWiki:Foobar', true ],
+                       [ 'MediaWiki:Foo bar', true ],
+                       [ 'MediaWiki:Foo-bar', true ],
+                       [ 'MediaWiki:foo bar', true ],
+                       [ 'MediaWiki:foo-bar', true ],
+                       [ 'MediaWiki:foobar', true ],
+                       [ 'MediaWiki:some-other-message', false ],
+                       [ 'Main Page', false ],
+               ];
+       }
 }