protected function setUp() {
parent::setUp();
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgLanguageCode' => 'en',
'wgContLang' => Language::factory( 'en' ),
// User language
'wgAllowUserJs' => false,
'wgDefaultLanguageVariant' => false,
'wgMetaNamespace' => 'Project',
- ) );
+ ] );
}
/**
}
public static function provideValidSecureAndSplit() {
- return array(
- array( 'Sandbox' ),
- array( 'A "B"' ),
- array( 'A \'B\'' ),
- array( '.com' ),
- array( '~' ),
- array( '#' ),
- array( '"' ),
- array( '\'' ),
- array( 'Talk:Sandbox' ),
- array( 'Talk:Foo:Sandbox' ),
- array( 'File:Example.svg' ),
- array( 'File_talk:Example.svg' ),
- array( 'Foo/.../Sandbox' ),
- array( 'Sandbox/...' ),
- array( 'A~~' ),
- array( ':A' ),
+ return [
+ [ 'Sandbox' ],
+ [ 'A "B"' ],
+ [ 'A \'B\'' ],
+ [ '.com' ],
+ [ '~' ],
+ [ '#' ],
+ [ '"' ],
+ [ '\'' ],
+ [ 'Talk:Sandbox' ],
+ [ 'Talk:Foo:Sandbox' ],
+ [ 'File:Example.svg' ],
+ [ 'File_talk:Example.svg' ],
+ [ 'Foo/.../Sandbox' ],
+ [ 'Sandbox/...' ],
+ [ 'A~~' ],
+ [ ':A' ],
// Length is 256 total, but only title part matters
- array( 'Category:' . str_repeat( 'x', 248 ) ),
- array( str_repeat( 'x', 252 ) ),
+ [ 'Category:' . str_repeat( 'x', 248 ) ],
+ [ str_repeat( 'x', 252 ) ],
// interwiki prefix
- array( 'localtestiw: #anchor' ),
- array( 'localtestiw:' ),
- array( 'localtestiw:foo' ),
- array( 'localtestiw: foo # anchor' ),
- array( 'localtestiw: Talk: Sandbox # anchor' ),
- array( 'remotetestiw:' ),
- array( 'remotetestiw: Talk: # anchor' ),
- array( 'remotetestiw: #bar' ),
- array( 'remotetestiw: Talk:' ),
- array( 'remotetestiw: Talk: Foo' ),
- array( 'localtestiw:remotetestiw:' ),
- array( 'localtestiw:remotetestiw:foo' )
- );
+ [ 'localtestiw: #anchor' ],
+ [ 'localtestiw:' ],
+ [ 'localtestiw:foo' ],
+ [ 'localtestiw: foo # anchor' ],
+ [ 'localtestiw: Talk: Sandbox # anchor' ],
+ [ 'remotetestiw:' ],
+ [ 'remotetestiw: Talk: # anchor' ],
+ [ 'remotetestiw: #bar' ],
+ [ 'remotetestiw: Talk:' ],
+ [ 'remotetestiw: Talk: Foo' ],
+ [ 'localtestiw:remotetestiw:' ],
+ [ 'localtestiw:remotetestiw:foo' ]
+ ];
}
public static function provideInvalidSecureAndSplit() {
- return array(
- array( '', 'title-invalid-empty' ),
- array( ':', 'title-invalid-empty' ),
- array( '__ __', 'title-invalid-empty' ),
- array( ' __ ', 'title-invalid-empty' ),
+ return [
+ [ '', 'title-invalid-empty' ],
+ [ ':', 'title-invalid-empty' ],
+ [ '__ __', 'title-invalid-empty' ],
+ [ ' __ ', 'title-invalid-empty' ],
// Bad characters forbidden regardless of wgLegalTitleChars
- array( 'A [ B', 'title-invalid-characters' ),
- array( 'A ] B', 'title-invalid-characters' ),
- array( 'A { B', 'title-invalid-characters' ),
- array( 'A } B', 'title-invalid-characters' ),
- array( 'A < B', 'title-invalid-characters' ),
- array( 'A > B', 'title-invalid-characters' ),
- array( 'A | B', 'title-invalid-characters' ),
+ [ 'A [ B', 'title-invalid-characters' ],
+ [ 'A ] B', 'title-invalid-characters' ],
+ [ 'A { B', 'title-invalid-characters' ],
+ [ 'A } B', 'title-invalid-characters' ],
+ [ 'A < B', 'title-invalid-characters' ],
+ [ 'A > B', 'title-invalid-characters' ],
+ [ 'A | B', 'title-invalid-characters' ],
// URL encoding
- array( 'A%20B', 'title-invalid-characters' ),
- array( 'A%23B', 'title-invalid-characters' ),
- array( 'A%2523B', 'title-invalid-characters' ),
+ [ 'A%20B', 'title-invalid-characters' ],
+ [ 'A%23B', 'title-invalid-characters' ],
+ [ 'A%2523B', 'title-invalid-characters' ],
// XML/HTML character entity references
// Note: Commented out because they are not marked invalid by the PHP test as
// Title::newFromText runs Sanitizer::decodeCharReferencesAndNormalize first.
// 'A é B',
// 'A é B',
// Subject of NS_TALK does not roundtrip to NS_MAIN
- array( 'Talk:File:Example.svg', 'title-invalid-talk-namespace' ),
+ [ 'Talk:File:Example.svg', 'title-invalid-talk-namespace' ],
// Directory navigation
- array( '.', 'title-invalid-relative' ),
- array( '..', 'title-invalid-relative' ),
- array( './Sandbox', 'title-invalid-relative' ),
- array( '../Sandbox', 'title-invalid-relative' ),
- array( 'Foo/./Sandbox', 'title-invalid-relative' ),
- array( 'Foo/../Sandbox', 'title-invalid-relative' ),
- array( 'Sandbox/.', 'title-invalid-relative' ),
- array( 'Sandbox/..', 'title-invalid-relative' ),
+ [ '.', 'title-invalid-relative' ],
+ [ '..', 'title-invalid-relative' ],
+ [ './Sandbox', 'title-invalid-relative' ],
+ [ '../Sandbox', 'title-invalid-relative' ],
+ [ 'Foo/./Sandbox', 'title-invalid-relative' ],
+ [ 'Foo/../Sandbox', 'title-invalid-relative' ],
+ [ 'Sandbox/.', 'title-invalid-relative' ],
+ [ 'Sandbox/..', 'title-invalid-relative' ],
// Tilde
- array( 'A ~~~ Name', 'title-invalid-magic-tilde' ),
- array( 'A ~~~~ Signature', 'title-invalid-magic-tilde' ),
- array( 'A ~~~~~ Timestamp', 'title-invalid-magic-tilde' ),
+ [ 'A ~~~ Name', 'title-invalid-magic-tilde' ],
+ [ 'A ~~~~ Signature', 'title-invalid-magic-tilde' ],
+ [ 'A ~~~~~ Timestamp', 'title-invalid-magic-tilde' ],
// Length
- array( str_repeat( 'x', 256 ), 'title-invalid-too-long' ),
+ [ str_repeat( 'x', 256 ), 'title-invalid-too-long' ],
// Namespace prefix without actual title
- array( 'Talk:', 'title-invalid-empty' ),
- array( 'Talk:#', 'title-invalid-empty' ),
- array( 'Category: ', 'title-invalid-empty' ),
- array( 'Category: #bar', 'title-invalid-empty' ),
+ [ 'Talk:', 'title-invalid-empty' ],
+ [ 'Talk:#', 'title-invalid-empty' ],
+ [ 'Category: ', 'title-invalid-empty' ],
+ [ 'Category: #bar', 'title-invalid-empty' ],
// interwiki prefix
- array( 'localtestiw: Talk: # anchor', 'title-invalid-empty' ),
- array( 'localtestiw: Talk:', 'title-invalid-empty' )
- );
+ [ 'localtestiw: Talk: # anchor', 'title-invalid-empty' ],
+ [ 'localtestiw: Talk:', 'title-invalid-empty' ]
+ ];
}
private function secureAndSplitGlobals() {
- $this->setMwGlobals( array(
- 'wgLocalInterwikis' => array( 'localtestiw' ),
- 'wgHooks' => array(
- 'InterwikiLoadPrefix' => array(
+ $this->setMwGlobals( [
+ 'wgLocalInterwikis' => [ 'localtestiw' ],
+ 'wgHooks' => [
+ 'InterwikiLoadPrefix' => [
function ( $prefix, &$data ) {
if ( $prefix === 'localtestiw' ) {
- $data = array( 'iw_url' => 'localtestiw' );
+ $data = [ 'iw_url' => 'localtestiw' ];
} elseif ( $prefix === 'remotetestiw' ) {
- $data = array( 'iw_url' => 'remotetestiw' );
+ $data = [ 'iw_url' => 'remotetestiw' ];
}
return false;
}
- )
- )
- ) );
+ ]
+ ]
+ ] );
}
/**
}
public static function provideConvertByteClassToUnicodeClass() {
- return array(
- array(
+ return [
+ [
' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+',
' %!"$&\'()*,\\-./0-9:;=?@A-Z\\\\\\^_`a-z~+\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTYf-\\xFF+',
'QWERTYf-\\x7F+\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTY\\x66-\\xFD+',
'QWERTYf-\\x7F+\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTYf-y+',
'QWERTYf-y+',
- ),
- array(
+ ],
+ [
'QWERTYf-\\x80+',
'QWERTYf-\\x7F+\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTY\\x66-\\x80+\\x23',
'QWERTYf-\\x7F+#\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTY\\x66-\\x80+\\xD3',
'QWERTYf-\\x7F+\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'\\\\\\x99',
'\\\\\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'-\\x99',
'\\-\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'QWERTY\\-\\x99',
'QWERTY\\-\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'\\\\x99',
'\\\\x99',
- ),
- array(
+ ],
+ [
'A-\\x9F',
'A-\\x7F\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'\\x66-\\x77QWERTY\\x88-\\x91FXZ',
'f-wQWERTYFXZ\\u0080-\\uFFFF',
- ),
- array(
+ ],
+ [
'\\x66-\\x99QWERTY\\xAA-\\xEEFXZ',
'f-\\x7FQWERTYFXZ\\u0080-\\uFFFF',
- ),
- );
+ ],
+ ];
}
/**
}
public static function provideSpecialNamesWithAndWithoutParameter() {
- return array(
- array( 'Special:Version', null ),
- array( 'Special:Version/', '' ),
- array( 'Special:Version/param', 'param' ),
- );
+ return [
+ [ 'Special:Version', null ],
+ [ 'Special:Version/', '' ],
+ [ 'Special:Version/param', 'param' ],
+ ];
}
/**
}
public static function provideTestIsValidMoveOperation() {
- return array(
+ return [
// for Title::isValidMoveOperation
- array( 'Some page', '', 'badtitletext' ),
- array( 'Test', 'Test', 'selfmove' ),
- array( 'Special:FooBar', 'Test', 'immobile-source-namespace' ),
- array( 'Test', 'Special:FooBar', 'immobile-target-namespace' ),
- array( 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ),
- array( 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ),
+ [ 'Some page', '', 'badtitletext' ],
+ [ 'Test', 'Test', 'selfmove' ],
+ [ 'Special:FooBar', 'Test', 'immobile-source-namespace' ],
+ [ '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
- array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ),
- );
+ [ 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ],
+ ];
}
/**
// as a string. Thus we cast to an array() to honor $wgWhitelistReadRegexp
// type requisite.
if ( is_string( $whitelistRegexp ) ) {
- $whitelistRegexp = array( $whitelistRegexp );
+ $whitelistRegexp = [ $whitelistRegexp ];
}
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
// So User::isEveryoneAllowed( 'read' ) === false
- 'wgGroupPermissions' => array( '*' => array( 'read' => false ) ),
- 'wgWhitelistRead' => array( 'some random non sense title' ),
+ 'wgGroupPermissions' => [ '*' => [ 'read' => false ] ],
+ 'wgWhitelistRead' => [ 'some random non sense title' ],
'wgWhitelistReadRegexp' => $whitelistRegexp,
- ) );
+ ] );
$title = Title::newFromDBkey( $source );
// New anonymous user with no rights
$user = new User;
- $user->mRights = array();
+ $user->mRights = [];
$errors = $title->userCan( $action, $user );
if ( is_bool( $expected ) ) {
$ALLOWED = true;
$DISALLOWED = false;
- return array(
+ return [
// Everything, if this doesn't work, we're really in trouble
- array( '/.*/', 'Main_Page', 'read', $ALLOWED ),
- array( '/.*/', 'Main_Page', 'edit', $DISALLOWED ),
+ [ '/.*/', 'Main_Page', 'read', $ALLOWED ],
+ [ '/.*/', 'Main_Page', 'edit', $DISALLOWED ],
// We validate against the title name, not the db key
- array( '/^Main_Page$/', 'Main_Page', 'read', $DISALLOWED ),
+ [ '/^Main_Page$/', 'Main_Page', 'read', $DISALLOWED ],
// Main page
- array( '/^Main/', 'Main_Page', 'read', $ALLOWED ),
- array( '/^Main.*/', 'Main_Page', 'read', $ALLOWED ),
+ [ '/^Main/', 'Main_Page', 'read', $ALLOWED ],
+ [ '/^Main.*/', 'Main_Page', 'read', $ALLOWED ],
// With spaces
- array( '/Mic\sCheck/', 'Mic Check', 'read', $ALLOWED ),
+ [ '/Mic\sCheck/', 'Mic Check', 'read', $ALLOWED ],
// Unicode multibyte
// ...without unicode modifier
- array( '/Unicode Test . Yes/', 'Unicode Test Ñ Yes', 'read', $DISALLOWED ),
+ [ '/Unicode Test . Yes/', 'Unicode Test Ñ Yes', 'read', $DISALLOWED ],
// ...with unicode modifier
- array( '/Unicode Test . Yes/u', 'Unicode Test Ñ Yes', 'read', $ALLOWED ),
+ [ '/Unicode Test . Yes/u', 'Unicode Test Ñ Yes', 'read', $ALLOWED ],
// Case insensitive
- array( '/MiC ChEcK/', 'mic check', 'read', $DISALLOWED ),
- array( '/MiC ChEcK/i', 'mic check', 'read', $ALLOWED ),
+ [ '/MiC ChEcK/', 'mic check', 'read', $DISALLOWED ],
+ [ '/MiC ChEcK/i', 'mic check', 'read', $ALLOWED ],
// From DefaultSettings.php:
- array( "@^UsEr.*@i", 'User is banned', 'read', $ALLOWED ),
- array( "@^UsEr.*@i", 'User:John Doe', 'read', $ALLOWED ),
+ [ "@^UsEr.*@i", 'User is banned', 'read', $ALLOWED ],
+ [ "@^UsEr.*@i", 'User:John Doe', 'read', $ALLOWED ],
// With namespaces:
- array( '/^Special:NewPages$/', 'Special:NewPages', 'read', $ALLOWED ),
- array( null, 'Special:Newpages', 'read', $DISALLOWED ),
+ [ '/^Special:NewPages$/', 'Special:NewPages', 'read', $ALLOWED ],
+ [ null, 'Special:Newpages', 'read', $DISALLOWED ],
- );
+ ];
}
public function flattenErrorsArray( $errors ) {
- $result = array();
+ $result = [];
foreach ( $errors as $error ) {
$result[] = $error[0];
}
$lang, $variant, $msg = ''
) {
// Setup environnement for this test
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgLanguageCode' => $contLang,
'wgContLang' => Language::factory( $contLang ),
'wgLang' => Language::factory( $lang ),
'wgDefaultLanguageVariant' => $variant,
'wgAllowUserJs' => true,
- ) );
+ ] );
$title = Title::newFromText( $titleText );
$this->assertInstanceOf( 'Title', $title,
# - wgLang (on some specific pages)
# - wgDefaultLanguageVariant
# - Optional message
- return array(
- array( 'fr', 'Help:I_need_somebody', 'fr', 'fr', false ),
- array( 'es', 'Help:I_need_somebody', 'es', 'zh-tw', false ),
- array( 'zh', 'Help:I_need_somebody', 'zh', 'zh-tw', false ),
-
- array( 'es', 'Help:I_need_somebody', 'es', 'zh-tw', 'zh-cn' ),
- array( 'es', 'MediaWiki:About', 'es', 'zh-tw', 'zh-cn' ),
- array( 'es', 'MediaWiki:About/', 'es', 'zh-tw', 'zh-cn' ),
- array( 'de', 'MediaWiki:About/de', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.js', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.css', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Common.js', 'es', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Monobook.css', 'es', 'zh-tw', 'zh-cn' ),
-
- array( 'zh-cn', 'Help:I_need_somebody', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh', 'MediaWiki:About', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh', 'MediaWiki:About/', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'de', 'MediaWiki:About/de', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh-cn', 'MediaWiki:About/zh-cn', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'zh-tw', 'MediaWiki:About/zh-tw', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.js', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'MediaWiki:Common.css', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Common.js', 'zh', 'zh-tw', 'zh-cn' ),
- array( 'en', 'User:JohnDoe/Monobook.css', 'zh', 'zh-tw', 'zh-cn' ),
-
- array( 'zh-tw', 'Special:NewPages', 'es', 'zh-tw', 'zh-cn' ),
- array( 'zh-tw', 'Special:NewPages', 'zh', 'zh-tw', 'zh-cn' ),
-
- );
+ return [
+ [ 'fr', 'Help:I_need_somebody', 'fr', 'fr', false ],
+ [ 'es', 'Help:I_need_somebody', 'es', 'zh-tw', false ],
+ [ 'zh', 'Help:I_need_somebody', 'zh', 'zh-tw', false ],
+
+ [ 'es', 'Help:I_need_somebody', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'es', 'MediaWiki:About', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'es', 'MediaWiki:About/', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'de', 'MediaWiki:About/de', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'MediaWiki:Common.js', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'MediaWiki:Common.css', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'User:JohnDoe/Common.js', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'User:JohnDoe/Monobook.css', 'es', 'zh-tw', 'zh-cn' ],
+
+ [ 'zh-cn', 'Help:I_need_somebody', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'zh', 'MediaWiki:About', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'zh', 'MediaWiki:About/', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'de', 'MediaWiki:About/de', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'zh-cn', 'MediaWiki:About/zh-cn', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'zh-tw', 'MediaWiki:About/zh-tw', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'MediaWiki:Common.js', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'MediaWiki:Common.css', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'User:JohnDoe/Common.js', 'zh', 'zh-tw', 'zh-cn' ],
+ [ 'en', 'User:JohnDoe/Monobook.css', 'zh', 'zh-tw', 'zh-cn' ],
+
+ [ 'zh-tw', 'Special:NewPages', 'es', 'zh-tw', 'zh-cn' ],
+ [ 'zh-tw', 'Special:NewPages', 'zh', 'zh-tw', 'zh-cn' ],
+
+ ];
}
/**
}
public static function provideBaseTitleCases() {
- return array(
+ return [
# Title, expected base, optional message
- array( 'User:John_Doe/subOne/subTwo', 'John Doe/subOne' ),
- array( 'User:Foo/Bar/Baz', 'Foo/Bar' ),
- );
+ [ 'User:John_Doe/subOne/subTwo', 'John Doe/subOne' ],
+ [ 'User:Foo/Bar/Baz', 'Foo/Bar' ],
+ ];
}
/**
}
public static function provideRootTitleCases() {
- return array(
+ return [
# Title, expected base, optional message
- array( 'User:John_Doe/subOne/subTwo', 'John Doe' ),
- array( 'User:Foo/Bar/Baz', 'Foo' ),
- );
+ [ 'User:John_Doe/subOne/subTwo', 'John Doe' ],
+ [ 'User:Foo/Bar/Baz', 'Foo' ],
+ ];
}
/**
}
public static function provideSubpageTitleCases() {
- return array(
+ return [
# Title, expected base, optional message
- array( 'User:John_Doe/subOne/subTwo', 'subTwo' ),
- array( 'User:John_Doe/subOne', 'subOne' ),
- );
+ [ 'User:John_Doe/subOne/subTwo', 'subTwo' ],
+ [ 'User:John_Doe/subOne', 'subOne' ],
+ ];
}
public static function provideNewFromTitleValue() {
- return array(
- array( new TitleValue( NS_MAIN, 'Foo' ) ),
- array( new TitleValue( NS_MAIN, 'Foo', 'bar' ) ),
- array( new TitleValue( NS_USER, 'Hansi_Maier' ) ),
- );
+ return [
+ [ new TitleValue( NS_MAIN, 'Foo' ) ],
+ [ new TitleValue( NS_MAIN, 'Foo', 'bar' ) ],
+ [ new TitleValue( NS_USER, 'Hansi_Maier' ) ],
+ ];
}
/**
}
public static function provideGetTitleValue() {
- return array(
- array( 'Foo' ),
- array( 'Foo#bar' ),
- array( 'User:Hansi_Maier' ),
- );
+ return [
+ [ 'Foo' ],
+ [ 'Foo#bar' ],
+ [ 'User:Hansi_Maier' ],
+ ];
}
/**
}
public static function provideGetFragment() {
- return array(
- array( 'Foo', '' ),
- array( 'Foo#bar', 'bar' ),
- array( 'Foo#bär', 'bär' ),
+ return [
+ [ 'Foo', '' ],
+ [ 'Foo#bar', 'bar' ],
+ [ 'Foo#bär', 'bär' ],
// Inner whitespace is normalized
- array( 'Foo#bar_bar', 'bar bar' ),
- array( 'Foo#bar bar', 'bar bar' ),
- array( 'Foo#bar bar', 'bar bar' ),
+ [ 'Foo#bar_bar', 'bar bar' ],
+ [ 'Foo#bar bar', 'bar bar' ],
+ [ 'Foo#bar bar', 'bar bar' ],
// Leading whitespace is kept, trailing whitespace is trimmed.
// XXX: Is this really want we want?
- array( 'Foo#_bar_bar_', ' bar bar' ),
- array( 'Foo# bar bar ', ' bar bar' ),
- );
+ [ 'Foo#_bar_bar_', ' bar bar' ],
+ [ 'Foo# bar bar ', ' bar bar' ],
+ ];
}
/**
}
public static function provideIsAlwaysKnown() {
- return array(
- array( 'Some nonexistent page', false ),
- array( 'UTPage', false ),
- array( '#test', true ),
- array( 'Special:BlankPage', true ),
- array( 'Special:SomeNonexistentSpecialPage', false ),
- array( 'MediaWiki:Parentheses', true ),
- array( 'MediaWiki:Some nonexistent message', false ),
- );
+ return [
+ [ 'Some nonexistent page', false ],
+ [ 'UTPage', false ],
+ [ '#test', true ],
+ [ 'Special:BlankPage', true ],
+ [ 'Special:SomeNonexistentSpecialPage', false ],
+ [ 'MediaWiki:Parentheses', true ],
+ [ 'MediaWiki:Some nonexistent message', false ],
+ ];
}
/**
$linkCache->clearLink( $title );
$linkCache->addBadLinkObj( $title );
- $this->assertEquals( false, $title->exists(), 'exists() should rely on link cache unless GAID_FOR_UPDATE is used' );
- $this->assertEquals( true, $title->exists( Title::GAID_FOR_UPDATE ), 'exists() should re-query database when GAID_FOR_UPDATE is used' );
+ $this->assertEquals(
+ false,
+ $title->exists(),
+ 'exists() should rely on link cache unless GAID_FOR_UPDATE is used'
+ );
+ $this->assertEquals(
+ true,
+ $title->exists( Title::GAID_FOR_UPDATE ),
+ 'exists() should re-query database when GAID_FOR_UPDATE is used'
+ );
}
}