Convert all array() syntax to []
[lhc/web/wiklou.git] / tests / phpunit / includes / resourceloader / ResourceLoaderStartUpModuleTest.php
index 9a36d18..72ea495 100644 (file)
@@ -8,27 +8,27 @@ class ResourceLoaderStartUpModuleTest extends ResourceLoaderTestCase {
        protected static $blankVersion = 'GqV9IPpY';
 
        protected static function expandPlaceholders( $text ) {
-               return strtr( $text, array(
+               return strtr( $text, [
                        '{blankVer}' => self::$blankVersion
-               ) );
+               ] );
        }
 
        public static function provideGetModuleRegistrations() {
-               return array(
-                       array( array(
+               return [
+                       [ [
                                'msg' => 'Empty registry',
-                               'modules' => array(),
+                               'modules' => [],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php"
 } );
 mw.loader.register( [] );'
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                'msg' => 'Basic registry',
-                               'modules' => array(
+                               'modules' => [
                                        'test.blank' => new ResourceLoaderTestModule(),
-                               ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php"
@@ -39,14 +39,14 @@ mw.loader.register( [
         "{blankVer}"
     ]
 ] );',
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                'msg' => 'Group signature',
-                               'modules' => array(
+                               'modules' => [
                                        'test.blank' => new ResourceLoaderTestModule(),
-                                       'test.group.foo' => new ResourceLoaderTestModule( array( 'group' => 'x-foo' ) ),
-                                       'test.group.bar' => new ResourceLoaderTestModule( array( 'group' => 'x-bar' ) ),
-                               ),
+                                       'test.group.foo' => new ResourceLoaderTestModule( [ 'group' => 'x-foo' ] ),
+                                       'test.group.bar' => new ResourceLoaderTestModule( [ 'group' => 'x-bar' ] ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php"
@@ -69,13 +69,13 @@ mw.loader.register( [
         "x-bar"
     ]
 ] );'
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                'msg' => 'Different target (non-test should not be registered)',
-                               'modules' => array(
+                               'modules' => [
                                        'test.blank' => new ResourceLoaderTestModule(),
-                                       'test.target.foo' => new ResourceLoaderTestModule( array( 'targets' => array( 'x-foo' ) ) ),
-                               ),
+                                       'test.target.foo' => new ResourceLoaderTestModule( [ 'targets' => [ 'x-foo' ] ] ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php"
@@ -86,18 +86,18 @@ mw.loader.register( [
         "{blankVer}"
     ]
 ] );'
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                'msg' => 'Foreign source',
-                               'sources' => array(
-                                       'example' => array(
+                               'sources' => [
+                                       'example' => [
                                                'loadScript' => 'http://example.org/w/load.php',
                                                'apiScript' => 'http://example.org/w/api.php',
-                                       ),
-                               ),
-                               'modules' => array(
-                                       'test.blank' => new ResourceLoaderTestModule( array( 'source' => 'example' ) ),
-                               ),
+                                       ],
+                               ],
+                               'modules' => [
+                                       'test.blank' => new ResourceLoaderTestModule( [ 'source' => 'example' ] ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php",
@@ -112,30 +112,30 @@ mw.loader.register( [
         "example"
     ]
 ] );'
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                'msg' => 'Conditional dependency function',
-                               'modules' => array(
+                               'modules' => [
                                        'test.x.core' => new ResourceLoaderTestModule(),
-                                       'test.x.polyfill' => new ResourceLoaderTestModule( array(
+                                       'test.x.polyfill' => new ResourceLoaderTestModule( [
                                                'skipFunction' => 'return true;'
-                                       ) ),
-                                       'test.y.polyfill' => new ResourceLoaderTestModule( array(
+                                       ] ),
+                                       'test.y.polyfill' => new ResourceLoaderTestModule( [
                                                'skipFunction' =>
                                                        'return !!(' .
                                                        '    window.JSON &&' .
                                                        '    JSON.parse &&' .
                                                        '    JSON.stringify' .
                                                        ');'
-                                       ) ),
-                                       'test.z.foo' => new ResourceLoaderTestModule( array(
-                                               'dependencies' => array(
+                                       ] ),
+                                       'test.z.foo' => new ResourceLoaderTestModule( [
+                                               'dependencies' => [
                                                        'test.x.core',
                                                        'test.x.polyfill',
                                                        'test.y.polyfill',
-                                               ),
-                                       ) ),
-                               ),
+                                               ],
+                                       ] ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php"
@@ -171,67 +171,67 @@ mw.loader.register( [
         ]
     ]
 ] );',
-                       ) ),
-                       array( array(
+                       ] ],
+                       [ [
                                // This may seem like an edge case, but a plain MediaWiki core install
                                // with a few extensions installed is likely far more complex than this
                                // even, not to mention an install like Wikipedia.
                                // TODO: Make this even more realistic.
                                'msg' => 'Advanced (everything combined)',
-                               'sources' => array(
-                                       'example' => array(
+                               'sources' => [
+                                       'example' => [
                                                'loadScript' => 'http://example.org/w/load.php',
                                                'apiScript' => 'http://example.org/w/api.php',
-                                       ),
-                               ),
-                               'modules' => array(
+                                       ],
+                               ],
+                               'modules' => [
                                        'test.blank' => new ResourceLoaderTestModule(),
                                        'test.x.core' => new ResourceLoaderTestModule(),
-                                       'test.x.util' => new ResourceLoaderTestModule( array(
-                                               'dependencies' => array(
+                                       'test.x.util' => new ResourceLoaderTestModule( [
+                                               'dependencies' => [
                                                        'test.x.core',
-                                               ),
-                                       ) ),
-                                       'test.x.foo' => new ResourceLoaderTestModule( array(
-                                               'dependencies' => array(
+                                               ],
+                                       ] ),
+                                       'test.x.foo' => new ResourceLoaderTestModule( [
+                                               'dependencies' => [
                                                        'test.x.core',
-                                               ),
-                                       ) ),
-                                       'test.x.bar' => new ResourceLoaderTestModule( array(
-                                               'dependencies' => array(
+                                               ],
+                                       ] ),
+                                       'test.x.bar' => new ResourceLoaderTestModule( [
+                                               'dependencies' => [
                                                        'test.x.core',
                                                        'test.x.util',
-                                               ),
-                                       ) ),
-                                       'test.x.quux' => new ResourceLoaderTestModule( array(
-                                               'dependencies' => array(
+                                               ],
+                                       ] ),
+                                       'test.x.quux' => new ResourceLoaderTestModule( [
+                                               'dependencies' => [
                                                        'test.x.foo',
                                                        'test.x.bar',
                                                        'test.x.util',
                                                        'test.x.unknown',
-                                               ),
-                                       ) ),
-                                       'test.group.foo.1' => new ResourceLoaderTestModule( array(
+                                               ],
+                                       ] ),
+                                       'test.group.foo.1' => new ResourceLoaderTestModule( [
                                                'group' => 'x-foo',
-                                       ) ),
-                                       'test.group.foo.2' => new ResourceLoaderTestModule( array(
+                                       ] ),
+                                       'test.group.foo.2' => new ResourceLoaderTestModule( [
                                                'group' => 'x-foo',
-                                       ) ),
-                                       'test.group.bar.1' => new ResourceLoaderTestModule( array(
+                                       ] ),
+                                       'test.group.bar.1' => new ResourceLoaderTestModule( [
                                                'group' => 'x-bar',
-                                       ) ),
-                                       'test.group.bar.2' => new ResourceLoaderTestModule( array(
+                                       ] ),
+                                       'test.group.bar.2' => new ResourceLoaderTestModule( [
                                                'group' => 'x-bar',
                                                'source' => 'example',
-                                       ) ),
-                                       'test.target.foo' => new ResourceLoaderTestModule( array(
-                                               'targets' => array( 'x-foo' ),
-                                       ) ),
-                                       'test.target.bar' => new ResourceLoaderTestModule( array(
+                                       ] ),
+                                       'test.target.foo' => new ResourceLoaderTestModule( [
+                                               'targets' => [ 'x-foo' ],
+                                       ] ),
+                                       'test.target.bar' => new ResourceLoaderTestModule( [
                                                'source' => 'example',
-                                               'targets' => array( 'x-foo' ),
-                                       ) ),
-                               ),
+                                               'targets' => [ 'x-foo' ],
+                                       ] ),
+                               ],
                                'out' => '
 mw.loader.addSource( {
     "local": "/w/load.php",
@@ -302,8 +302,8 @@ mw.loader.register( [
         "example"
     ]
 ] );'
-                       ) ),
-               );
+                       ] ],
+               ];
        }
 
        /**
@@ -332,22 +332,22 @@ mw.loader.register( [
        }
 
        public static function provideRegistrations() {
-               return array(
-                       array( array(
+               return [
+                       [ [
                                'test.blank' => new ResourceLoaderTestModule(),
-                               'test.min' => new ResourceLoaderTestModule( array(
+                               'test.min' => new ResourceLoaderTestModule( [
                                        'skipFunction' =>
                                                'return !!(' .
                                                '    window.JSON &&' .
                                                '    JSON.parse &&' .
                                                '    JSON.stringify' .
                                                ');',
-                                       'dependencies' => array(
+                                       'dependencies' => [
                                                'test.blank',
-                                       ),
-                               ) ),
-                       ) )
-               );
+                                       ],
+                               ] ),
+                       ] ]
+               ];
        }
        /**
         * @dataProvider provideRegistrations