* @param array|string|bool $expected Required error
* @dataProvider provideTestIsValidMoveOperation
* @covers Title::isValidMoveOperation
- * @covers Title::validateFileMoveOperation
*/
public function testIsValidMoveOperation( $source, $target, $expected ) {
$this->setMwGlobals( 'wgContentHandlerUseDB', false );
[ 'Test', 'Special:FooBar', 'immobile-target-namespace' ],
[ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ],
[ 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ],
- // for Title::validateFileMoveOperation
[ 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ],
];
}
$this->assertSame( $expected, $actual, $title->getPrefixedDBkey() );
}
- /**
- * @dataProvider provideCanHaveTalkPage
- * @covers Title::canTalk
- *
- * @param Title $title
- * @param bool $expected
- */
- public function testCanTalk( Title $title, $expected ) {
- $actual = $title->canTalk();
- $this->assertSame( $expected, $actual, $title->getPrefixedDBkey() );
- }
-
public static function provideGetTalkPage_good() {
return [
[ Title::makeTitle( NS_MAIN, 'Test' ), Title::makeTitle( NS_TALK, 'Test' ) ],
[ '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 ],
+ ];
+ }
}