Convert all array() syntax to []
[lhc/web/wiklou.git] / tests / phpunit / includes / LinkerTest.php
index 19ab56f..8248257 100644 (file)
@@ -11,10 +11,10 @@ class LinkerTest extends MediaWikiLangTestCase {
         * @covers Linker::userLink
         */
        public function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
-               $this->setMwGlobals( array(
+               $this->setMwGlobals( [
                        'wgArticlePath' => '/wiki/$1',
                        'wgWellFormedXml' => true,
-               ) );
+               ] );
 
                $this->assertEquals( $expected,
                        Linker::userLink( $userId, $userName, $altUserName, $msg )
@@ -28,63 +28,63 @@ class LinkerTest extends MediaWikiLangTestCase {
                # - username
                # - optional altUserName
                # - optional message
-               return array(
+               return [
 
                        # ## ANONYMOUS USER ########################################
-                       array(
+                       [
                                '<a href="/wiki/Special:Contributions/JohnDoe" '
                                        . 'title="Special:Contributions/JohnDoe" '
                                        . 'class="mw-userlink mw-anonuserlink">JohnDoe</a>',
                                0, 'JohnDoe', false,
-                       ),
-                       array(
+                       ],
+                       [
                                '<a href="/wiki/Special:Contributions/::1" '
                                        . 'title="Special:Contributions/::1" '
                                        . 'class="mw-userlink mw-anonuserlink">::1</a>',
                                0, '::1', false,
                                'Anonymous with pretty IPv6'
-                       ),
-                       array(
+                       ],
+                       [
                                '<a href="/wiki/Special:Contributions/0:0:0:0:0:0:0:1" '
                                        . 'title="Special:Contributions/0:0:0:0:0:0:0:1" '
                                        . 'class="mw-userlink mw-anonuserlink">::1</a>',
                                0, '0:0:0:0:0:0:0:1', false,
                                'Anonymous with almost pretty IPv6'
-                       ),
-                       array(
+                       ],
+                       [
                                '<a href="/wiki/Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
                                        . 'title="Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
                                        . 'class="mw-userlink mw-anonuserlink">::1</a>',
                                0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
                                'Anonymous with full IPv6'
-                       ),
-                       array(
+                       ],
+                       [
                                '<a href="/wiki/Special:Contributions/::1" '
                                        . 'title="Special:Contributions/::1" '
                                        . 'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
                                0, '::1', 'AlternativeUsername',
                                'Anonymous with pretty IPv6 and an alternative username'
-                       ),
+                       ],
 
                        # IPV4
-                       array(
+                       [
                                '<a href="/wiki/Special:Contributions/127.0.0.1" '
                                        . 'title="Special:Contributions/127.0.0.1" '
                                        . 'class="mw-userlink mw-anonuserlink">127.0.0.1</a>',
                                0, '127.0.0.1', false,
                                'Anonymous with IPv4'
-                       ),
-                       array(
+                       ],
+                       [
                                '<a href="/wiki/Special:Contributions/127.0.0.1" '
                                        . 'title="Special:Contributions/127.0.0.1" '
                                        . 'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
                                0, '127.0.0.1', 'AlternativeUsername',
                                'Anonymous with IPv4 and an alternative username'
-                       ),
+                       ],
 
                        # ## Regular user ##########################################
                        # TODO!
-               );
+               ];
        }
 
        /**
@@ -97,25 +97,25 @@ class LinkerTest extends MediaWikiLangTestCase {
                $expected, $comment, $title = false, $local = false, $wikiId = null
        ) {
                $conf = new SiteConfiguration();
-               $conf->settings = array(
-                       'wgServer' => array(
+               $conf->settings = [
+                       'wgServer' => [
                                'enwiki' => '//en.example.org',
                                'dewiki' => '//de.example.org',
-                       ),
-                       'wgArticlePath' => array(
+                       ],
+                       'wgArticlePath' => [
                                'enwiki' => '/w/$1',
                                'dewiki' => '/w/$1',
-                       ),
-               );
-               $conf->suffixes = array( 'wiki' );
+                       ],
+               ];
+               $conf->suffixes = [ 'wiki' ];
 
-               $this->setMwGlobals( array(
+               $this->setMwGlobals( [
                        'wgScript' => '/wiki/index.php',
                        'wgArticlePath' => '/wiki/$1',
                        'wgWellFormedXml' => true,
                        'wgCapitalLinks' => true,
                        'wgConf' => $conf,
-               ) );
+               ] );
 
                if ( $title === false ) {
                        // We need a page title that exists
@@ -131,6 +131,7 @@ class LinkerTest extends MediaWikiLangTestCase {
        public function provideCasesForFormatComment() {
                $wikiId = 'enwiki'; // $wgConf has a fake entry for this
 
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
                return array(
                        // Linker::formatComment
                        array(
@@ -254,6 +255,7 @@ class LinkerTest extends MediaWikiLangTestCase {
                                false, false, $wikiId
                        )
                );
+               // @codingStandardsIgnoreEnd
        }
 
        /**
@@ -263,22 +265,22 @@ class LinkerTest extends MediaWikiLangTestCase {
        public function testFormatLinksInComment( $expected, $input, $wiki ) {
 
                $conf = new SiteConfiguration();
-               $conf->settings = array(
-                       'wgServer' => array(
+               $conf->settings = [
+                       'wgServer' => [
                                'enwiki' => '//en.example.org'
-                       ),
-                       'wgArticlePath' => array(
+                       ],
+                       'wgArticlePath' => [
                                'enwiki' => '/w/$1',
-                       ),
-               );
-               $conf->suffixes = array( 'wiki' );
-               $this->setMwGlobals( array(
+                       ],
+               ];
+               $conf->suffixes = [ 'wiki' ];
+               $this->setMwGlobals( [
                        'wgScript' => '/wiki/index.php',
                        'wgArticlePath' => '/wiki/$1',
                        'wgWellFormedXml' => true,
                        'wgCapitalLinks' => true,
                        'wgConf' => $conf,
-               ) );
+               ] );
 
                $this->assertEquals(
                        $expected,
@@ -287,6 +289,7 @@ class LinkerTest extends MediaWikiLangTestCase {
        }
 
        public static function provideCasesForFormatLinksInComment() {
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
                return array(
                        array(
                                'foo bar <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>',
@@ -304,5 +307,6 @@ class LinkerTest extends MediaWikiLangTestCase {
                                'enwiki',
                        ),
                );
+               // @codingStandardsIgnoreEnd
        }
 }