<?php
+use MediaWiki\MediaWikiServices;
+
/**
* @group Database
* @group Title
# Format:
# - expected
# - Title name
- # - wgContLang (expected in most case)
+ # - content language (expected in most cases)
# - wgLang (on some specific pages)
# - wgDefaultLanguageVariant
# - Optional message
*/
public function testExists() {
$title = Title::makeTitle( NS_PROJECT, 'New page' );
- $linkCache = LinkCache::singleton();
+ $linkCache = MediaWikiServices::getInstance()->getLinkCache();
$article = new Article( $title );
$page = $article->getPage();
[ '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 ],
+ ];
+ }
}