public function isRawHtmlMessage() {
global $wgRawHtmlMessages;
- if ( $this->inNamespace( NS_MEDIAWIKI ) ) {
+ if ( !$this->inNamespace( NS_MEDIAWIKI ) ) {
return false;
}
- $message = lcfirst( $this->getRootText() );
+ $message = lcfirst( $this->getRootTitle()->getDBkey() );
return in_array( $message, $wgRawHtmlMessages, true );
}
[ '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 ],
+ ];
+ }
}