Wrap long lines
authorReedy <reedy@wikimedia.org>
Fri, 28 Sep 2012 23:35:16 +0000 (00:35 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 28 Sep 2012 23:35:16 +0000 (00:35 +0100)
Also remove default setting of $p done in else statement at end

Change-Id: I5024c1fc1748ad1add145d0696b33a6d7ef3223b

tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php

index 192689f..8867cd5 100644 (file)
@@ -34,8 +34,18 @@ class wfExpandUrl extends MediaWikiTestCase {
         */
        public function provideExpandableUrls() {
                $modes = array( 'http', 'https' );
-               $servers = array( 'http' => 'http://example.com', 'https' => 'https://example.com', 'protocol-relative' => '//example.com' );
-               $defaultProtos = array( 'http' => PROTO_HTTP, 'https' => PROTO_HTTPS, 'protocol-relative' => PROTO_RELATIVE, 'current' => PROTO_CURRENT, 'canonical' => PROTO_CANONICAL );
+               $servers = array(
+                       'http' => 'http://example.com',
+                       'https' => 'https://example.com',
+                       'protocol-relative' => '//example.com'
+               );
+               $defaultProtos = array(
+                       'http' => PROTO_HTTP,
+                       'https' => PROTO_HTTPS,
+                       'protocol-relative' => PROTO_RELATIVE,
+                       'current' => PROTO_CURRENT,
+                       'canonical' => PROTO_CANONICAL
+               );
 
                $retval = array();
                foreach ( $modes as $mode ) {
@@ -44,13 +54,27 @@ class wfExpandUrl extends MediaWikiTestCase {
                                foreach ( $modes as $canServerMode  ) {
                                        $canServer = "$canServerMode://example2.com";
                                        foreach ( $defaultProtos as $protoDesc => $defaultProto ) {
-                                               $retval[] = array( 'http://example.com', 'http://example.com', $defaultProto, $server, $canServer, $httpsMode, "Testing fully qualified http URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )" );
-                                               $retval[] = array( 'https://example.com', 'https://example.com', $defaultProto, $server, $canServer, $httpsMode, "Testing fully qualified https URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )" );
+                                               $retval[] = array(
+                                                       'http://example.com', 'http://example.com',
+                                                       $defaultProto, $server, $canServer, $httpsMode,
+                                                       "Testing fully qualified http URLs (no need to expand) ' .
+                                                       '(defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               );
+                                               $retval[] = array(
+                                                       'https://example.com', 'https://example.com',
+                                                       $defaultProto, $server, $canServer, $httpsMode,
+                                                       "Testing fully qualified https URLs (no need to expand) ' .
+                                                       '(defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               );
                                                # Would be nice to support this, see fixme on wfExpandUrl()
-                                               $retval[] = array( "wiki/FooBar", 'wiki/FooBar', $defaultProto, $server, $canServer, $httpsMode, "Test non-expandable relative URLs (defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )" );
+                                               $retval[] = array(
+                                                       "wiki/FooBar", 'wiki/FooBar',
+                                                       $defaultProto, $server, $canServer, $httpsMode,
+                                                       "Test non-expandable relative URLs ' .
+                                                       '(defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               );
 
                                                // Determine expected protocol
-                                               $p = $protoDesc . ':'; // default case
                                                if ( $protoDesc == 'protocol-relative' ) {
                                                        $p = '';
                                                } elseif ( $protoDesc == 'current' ) {
@@ -69,8 +93,18 @@ class wfExpandUrl extends MediaWikiTestCase {
                                                        $srv = $server;
                                                }
 
-                                               $retval[] = array( "$p//wikipedia.org", '//wikipedia.org', $defaultProto, $server, $canServer, $httpsMode, "Test protocol-relative URL (defaultProto: $protoDesc, wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )" );
-                                               $retval[] = array( "$srv/wiki/FooBar", '/wiki/FooBar', $defaultProto, $server, $canServer, $httpsMode, "Testing expanding URL beginning with / (defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )" );
+                                               $retval[] = array(
+                                                       "$p//wikipedia.org", '//wikipedia.org',
+                                                       $defaultProto, $server, $canServer, $httpsMode,
+                                                       "Test protocol-relative URL ' .
+                                                       '(defaultProto: $protoDesc, wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               );
+                                               $retval[] = array(
+                                                       "$srv/wiki/FooBar", '/wiki/FooBar',
+                                                       $defaultProto, $server, $canServer, $httpsMode,
+                                                       "Testing expanding URL beginning with / ' .
+                                                       '(defaultProto: $protoDesc , wgServer: $server, wgCanonicalServer: $canServer, current request protocol: $mode )"
+                                               );
                                        }
                                }
                        }