Merge "Finish stash uploads with upload dialog"
[lhc/web/wiklou.git] / tests / phpunit / skins / SideBarTest.php
index a3122b9..aaa1feb 100644 (file)
@@ -17,14 +17,14 @@ class SideBarTest extends MediaWikiLangTestCase {
        private function initMessagesHref() {
                # List of default messages for the sidebar. The sidebar doesn't care at
                # all whether they are full URLs, interwiki links or local titles.
-               $URL_messages = array(
+               $URL_messages = [
                        'mainpage',
                        'portal-url',
                        'currentevents-url',
                        'recentchanges-url',
                        'randompage-url',
                        'helppage',
-               );
+               ];
 
                # We're assuming that isValidURI works as advertised: it's also
                # tested separately, in tests/phpunit/includes/HttpTest.php.
@@ -54,7 +54,7 @@ class SideBarTest extends MediaWikiLangTestCase {
         * @todo this assert method to should be converted to a test using a dataprovider..
         */
        private function assertSideBar( $expected, $text, $message = '' ) {
-               $bar = array();
+               $bar = [];
                $this->skin->addToSidebarPlain( $bar, $text );
                $this->assertEquals( $expected, $bar, $message );
        }
@@ -64,10 +64,10 @@ class SideBarTest extends MediaWikiLangTestCase {
         */
        public function testSidebarWithOnlyTwoTitles() {
                $this->assertSideBar(
-                       array(
-                               'Title1' => array(),
-                               'Title2' => array(),
-                       ),
+                       [
+                               'Title1' => [],
+                               'Title2' => [],
+                       ],
                        '* Title1
 * Title2
 '
@@ -78,15 +78,15 @@ class SideBarTest extends MediaWikiLangTestCase {
         * @covers SkinTemplate::addToSidebarPlain
         */
        public function testExpandMessages() {
-               $this->assertSidebar(
-                       array( 'Title' => array(
-                               array(
+               $this->assertSideBar(
+                       [ 'Title' => [
+                               [
                                        'text' => 'Help',
                                        'href' => $this->messages['helppage']['href'],
                                        'id' => 'n-help',
                                        'active' => null
-                               )
-                       ) ),
+                               ]
+                       ] ],
                        '* Title
 ** helppage|help
 '
@@ -97,24 +97,24 @@ class SideBarTest extends MediaWikiLangTestCase {
         * @covers SkinTemplate::addToSidebarPlain
         */
        public function testExternalUrlsRequireADescription() {
-               $this->setMwGlobals( array(
+               $this->setMwGlobals( [
                        'wgNoFollowLinks' => true,
-                       'wgNoFollowDomainExceptions' => array(),
-                       'wgNoFollowNsExceptions' => array(),
-               ) );
-               $this->assertSidebar(
-                       array( 'Title' => array(
+                       'wgNoFollowDomainExceptions' => [],
+                       'wgNoFollowNsExceptions' => [],
+               ] );
+               $this->assertSideBar(
+                       [ 'Title' => [
                                # ** http://www.mediawiki.org/| Home
-                               array(
+                               [
                                        'text' => 'Home',
                                        'href' => 'http://www.mediawiki.org/',
                                        'id' => 'n-Home',
                                        'active' => null,
                                        'rel' => 'nofollow',
-                               ),
+                               ],
                                # ** http://valid.no.desc.org/
                                # ... skipped since it is missing a pipe with a description
-                       ) ),
+                       ] ],
                        '* Title
 ** http://www.mediawiki.org/| Home
 ** http://valid.no.desc.org/
@@ -128,25 +128,25 @@ class SideBarTest extends MediaWikiLangTestCase {
         * @covers SkinTemplate::addToSidebarPlain
         */
        public function testTrickyPipe() {
-               $this->assertSidebar(
-                       array( 'Title' => array(
+               $this->assertSideBar(
+                       [ 'Title' => [
                                # The first 2 are skipped
                                # Doesn't really test the url properly
                                # because it will vary with $wgArticlePath et al.
                                # ** Baz|Fred
-                               array(
+                               [
                                        'text' => 'Fred',
                                        'href' => Title::newFromText( 'Baz' )->getLocalURL(),
                                        'id' => 'n-Fred',
                                        'active' => null,
-                               ),
-                               array(
+                               ],
+                               [
                                        'text' => 'title-to-display',
                                        'href' => Title::newFromText( 'page-to-go-to' )->getLocalURL(),
                                        'id' => 'n-title-to-display',
                                        'active' => null,
-                               ),
-                       ) ),
+                               ],
+                       ] ],
                        '* Title
 ** {{PAGENAME|Foo}}
 ** Bar
@@ -162,8 +162,8 @@ class SideBarTest extends MediaWikiLangTestCase {
                $text = '* Title
 ** http://www.mediawiki.org/| Home';
 
-               $bar = array();
-               $this->skin->addToSideBarPlain( $bar, $text );
+               $bar = [];
+               $this->skin->addToSidebarPlain( $bar, $text );
 
                return $bar['Title'][0];
        }
@@ -172,12 +172,12 @@ class SideBarTest extends MediaWikiLangTestCase {
         * Simple test to verify our helper assertAttribs() is functional
         */
        public function testTestAttributesAssertionHelper() {
-               $this->setMwGlobals( array(
+               $this->setMwGlobals( [
                        'wgNoFollowLinks' => true,
-                       'wgNoFollowDomainExceptions' => array(),
-                       'wgNoFollowNsExceptions' => array(),
+                       'wgNoFollowDomainExceptions' => [],
+                       'wgNoFollowNsExceptions' => [],
                        'wgExternalLinkTarget' => false,
-               ) );
+               ] );
                $attribs = $this->getAttribs();
 
                $this->assertArrayHasKey( 'rel', $attribs );
@@ -211,9 +211,9 @@ class SideBarTest extends MediaWikiLangTestCase {
        }
 
        public static function dataRespectExternallinktarget() {
-               return array(
-                       array( '_blank' ),
-                       array( '_self' ),
-               );
+               return [
+                       [ '_blank' ],
+                       [ '_self' ],
+               ];
        }
 }