diff options
author | Kunal Mehta <legoktm@member.fsf.org> | 2016-02-17 01:09:32 -0800 |
---|---|---|
committer | Kunal Mehta <legoktm@member.fsf.org> | 2016-02-17 01:33:00 -0800 |
commit | 6e9b4f0e9ce4ccd6089c18b205065ef7fa077484 (patch) | |
tree | 58645fbce5c12d01b0d0fa87e338d4745e08920d /tests/phpunit/includes/cache | |
parent | 2fd379fa95f223c6b3f3c8eff6de068eca9e1a1a (diff) | |
download | mediawikicore-6e9b4f0e9ce4ccd6089c18b205065ef7fa077484.tar.gz mediawikicore-6e9b4f0e9ce4ccd6089c18b205065ef7fa077484.zip |
Convert all array() syntax to []
Per wikitech-l consensus:
https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html
Notes:
* Disabled CallTimePassByReference due to false positives (T127163)
Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
Diffstat (limited to 'tests/phpunit/includes/cache')
-rw-r--r-- | tests/phpunit/includes/cache/GenderCacheTest.php | 32 | ||||
-rw-r--r-- | tests/phpunit/includes/cache/LocalisationCacheTest.php | 30 | ||||
-rw-r--r-- | tests/phpunit/includes/cache/MessageCacheTest.php | 56 |
3 files changed, 59 insertions, 59 deletions
diff --git a/tests/phpunit/includes/cache/GenderCacheTest.php b/tests/phpunit/includes/cache/GenderCacheTest.php index d931b3901da7..a441b3d441ea 100644 --- a/tests/phpunit/includes/cache/GenderCacheTest.php +++ b/tests/phpunit/includes/cache/GenderCacheTest.php @@ -8,7 +8,7 @@ class GenderCacheTest extends MediaWikiLangTestCase { function addDBData() { // ensure the correct default gender - $this->mergeMwGlobalArrayValue( 'wgDefaultUserOptions', array( 'gender' => 'unknown' ) ); + $this->mergeMwGlobalArrayValue( 'wgDefaultUserOptions', [ 'gender' => 'unknown' ] ); $user = User::newFromName( 'UTMale' ); if ( $user->getID() == 0 ) { @@ -64,15 +64,15 @@ class GenderCacheTest extends MediaWikiLangTestCase { } public static function provideUserGenders() { - return array( - array( 'UTMale', 'male' ), - array( 'UTFemale', 'female' ), - array( 'UTDefaultGender', 'unknown' ), - array( 'UTNotExist', 'unknown' ), + return [ + [ 'UTMale', 'male' ], + [ 'UTFemale', 'female' ], + [ 'UTDefaultGender', 'unknown' ], + [ 'UTNotExist', 'unknown' ], // some not valid user - array( '127.0.0.1', 'unknown' ), - array( 'user@test', 'unknown' ), - ); + [ '127.0.0.1', 'unknown' ], + [ 'user@test', 'unknown' ], + ]; } /** @@ -89,12 +89,12 @@ class GenderCacheTest extends MediaWikiLangTestCase { } public static function provideStripSubpages() { - return array( - array( 'UTMale/subpage', 'male' ), - array( 'UTFemale/subpage', 'female' ), - array( 'UTDefaultGender/subpage', 'unknown' ), - array( 'UTNotExist/subpage', 'unknown' ), - array( '127.0.0.1/subpage', 'unknown' ), - ); + return [ + [ 'UTMale/subpage', 'male' ], + [ 'UTFemale/subpage', 'female' ], + [ 'UTDefaultGender/subpage', 'unknown' ], + [ 'UTNotExist/subpage', 'unknown' ], + [ '127.0.0.1/subpage', 'unknown' ], + ]; } } diff --git a/tests/phpunit/includes/cache/LocalisationCacheTest.php b/tests/phpunit/includes/cache/LocalisationCacheTest.php index a0d308aa75f7..7d62b018b3fe 100644 --- a/tests/phpunit/includes/cache/LocalisationCacheTest.php +++ b/tests/phpunit/includes/cache/LocalisationCacheTest.php @@ -8,10 +8,10 @@ class LocalisationCacheTest extends MediaWikiTestCase { protected function setUp() { parent::setUp(); - $this->setMwGlobals( array( - 'wgExtensionMessagesFiles' => array(), - 'wgHooks' => array(), - ) ); + $this->setMwGlobals( [ + 'wgExtensionMessagesFiles' => [], + 'wgHooks' => [], + ] ); } /** @@ -20,12 +20,12 @@ class LocalisationCacheTest extends MediaWikiTestCase { protected function getMockLocalisationCache() { global $IP; $lc = $this->getMockBuilder( 'LocalisationCache' ) - ->setConstructorArgs( array( array( 'store' => 'detect' ) ) ) - ->setMethods( array( 'getMessagesDirs' ) ) + ->setConstructorArgs( [ [ 'store' => 'detect' ] ] ) + ->setMethods( [ 'getMessagesDirs' ] ) ->getMock(); $lc->expects( $this->any() )->method( 'getMessagesDirs' ) ->will( $this->returnValue( - array( "$IP/tests/phpunit/data/localisationcache" ) + [ "$IP/tests/phpunit/data/localisationcache" ] ) ); return $lc; @@ -63,11 +63,11 @@ class LocalisationCacheTest extends MediaWikiTestCase { $lc = $this->getMockLocalisationCache(); $lc->recache( 'uk' ); $this->assertEquals( - array( + [ 'present-uk' => 'uk', 'present-ru' => 'ru', 'present-en' => 'en', - ), + ], $lc->getItem( 'uk', 'messages' ), 'Fallbacks are only used to fill missing data' ); @@ -76,8 +76,8 @@ class LocalisationCacheTest extends MediaWikiTestCase { public function testRecacheFallbacksWithHooks() { // Use hook to provide updates for messages. This is what the // LocalisationUpdate extension does. See bug 68781. - $this->mergeMwGlobalArrayValue( 'wgHooks', array( - 'LocalisationCacheRecacheFallback' => array( + $this->mergeMwGlobalArrayValue( 'wgHooks', [ + 'LocalisationCacheRecacheFallback' => [ function ( LocalisationCache $lc, $code, @@ -89,17 +89,17 @@ class LocalisationCacheTest extends MediaWikiTestCase { $cache['messages']['present-en'] = 'ru-override'; } } - ) - ) ); + ] + ] ); $lc = $this->getMockLocalisationCache(); $lc->recache( 'uk' ); $this->assertEquals( - array( + [ 'present-uk' => 'uk', 'present-ru' => 'ru-override', 'present-en' => 'ru-override', - ), + ], $lc->getItem( 'uk', 'messages' ), 'Updates provided by hooks follow the normal fallback order.' ); diff --git a/tests/phpunit/includes/cache/MessageCacheTest.php b/tests/phpunit/includes/cache/MessageCacheTest.php index 5302b363a3b5..ddd74e391924 100644 --- a/tests/phpunit/includes/cache/MessageCacheTest.php +++ b/tests/phpunit/includes/cache/MessageCacheTest.php @@ -22,11 +22,11 @@ class MessageCacheTest extends MediaWikiLangTestCase { $langCode = 'de'; $langObj = Language::factory( $langCode ); - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgLanguageCode' => $langCode, 'wgLang' => $langObj, 'wgContLang' => $langObj, - ) ); + ] ); } function addDBData() { @@ -89,20 +89,20 @@ class MessageCacheTest extends MediaWikiLangTestCase { } function provideMessagesForFallback() { - return array( - array( 'FallbackLanguageTest-Full', 'ab', 'ab' ), - array( 'FallbackLanguageTest-Partial', 'ab', 'ru' ), - array( 'FallbackLanguageTest-ContLang', 'ab', 'de' ), - array( 'FallbackLanguageTest-None', 'ab', false ), + return [ + [ 'FallbackLanguageTest-Full', 'ab', 'ab' ], + [ 'FallbackLanguageTest-Partial', 'ab', 'ru' ], + [ 'FallbackLanguageTest-ContLang', 'ab', 'de' ], + [ 'FallbackLanguageTest-None', 'ab', false ], // Existing message with customizations on the fallbacks - array( 'sunday', 'ab', 'амҽыш' ), + [ 'sunday', 'ab', 'амҽыш' ], // bug 46579 - array( 'FallbackLanguageTest-NoDervContLang', 'de', 'de/none' ), + [ 'FallbackLanguageTest-NoDervContLang', 'de', 'de/none' ], // UI language different from content language should only use de/none as last option - array( 'FallbackLanguageTest-NoDervContLang', 'fit', 'de/none' ), - ); + [ 'FallbackLanguageTest-NoDervContLang', 'fit', 'de/none' ], + ]; } /** @@ -117,11 +117,11 @@ class MessageCacheTest extends MediaWikiLangTestCase { } function provideMessagesForFullKeys() { - return array( - array( 'MessageCacheTest-FullKeyTest/ru', 'ru', 'ru' ), - array( 'MessageCacheTest-FullKeyTest/ru', 'ab', 'ru' ), - array( 'MessageCacheTest-FullKeyTest/ru/foo', 'ru', false ), - ); + return [ + [ 'MessageCacheTest-FullKeyTest/ru', 'ru', 'ru' ], + [ 'MessageCacheTest-FullKeyTest/ru', 'ab', 'ru' ], + [ 'MessageCacheTest-FullKeyTest/ru/foo', 'ru', false ], + ]; } /** @@ -133,17 +133,17 @@ class MessageCacheTest extends MediaWikiLangTestCase { } public function provideNormalizeKey() { - return array( - array( 'Foo', 'foo' ), - array( 'foo', 'foo' ), - array( 'fOo', 'fOo' ), - array( 'FOO', 'fOO' ), - array( 'Foo bar', 'foo_bar' ), - array( 'Ćab', 'ćab' ), - array( 'Ćab_e 3', 'ćab_e_3' ), - array( 'ĆAB', 'ćAB' ), - array( 'ćab', 'ćab' ), - array( 'ćaB', 'ćaB' ), - ); + return [ + [ 'Foo', 'foo' ], + [ 'foo', 'foo' ], + [ 'fOo', 'fOo' ], + [ 'FOO', 'fOO' ], + [ 'Foo bar', 'foo_bar' ], + [ 'Ćab', 'ćab' ], + [ 'Ćab_e 3', 'ćab_e_3' ], + [ 'ĆAB', 'ćAB' ], + [ 'ćab', 'ćab' ], + [ 'ćaB', 'ćaB' ], + ]; } } |