test: Remove MagicVariableTest#testServernameFromDifferentProtocols
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 24 Jun 2014 19:20:01 +0000 (21:20 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 25 Jun 2014 10:08:48 +0000 (12:08 +0200)
This test was causing failures locally when wgServer != localhost
because {{SERVERNAME}} is derived from wgServerName, not wgServer
and the test is only mocking wgServer.

> MagicVariableTest::testServername.. with data set #2 ('//localhost/')
> Magic servername should be <localhost:string>
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -localhost
> +krinkle.dev

This value is no longer derived by the Parser, but is instead
set using wfParserUrl in Setup.php.

Remove this obsolete test and add any missing test cases for
wgParserUrl to its test suite.

Change-Id: I7d7d201cb46841e63dac8ab9fd81b45b252264a3

tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php
tests/phpunit/includes/parser/MagicVariableTest.php

index 5032dc1..af834f8 100644 (file)
@@ -28,7 +28,11 @@ class WfParseUrlTest extends MediaWikiTestCase {
                parent::setUp();
 
                $this->setMwGlobals( 'wgUrlProtocols', array(
-                       '//', 'http://', 'file://', 'mailto:',
+                       '//',
+                       'http://',
+                       'https://',
+                       'file://',
+                       'mailto:',
                ) );
        }
 
@@ -36,11 +40,9 @@ class WfParseUrlTest extends MediaWikiTestCase {
         * @dataProvider provideURLs
         */
        public function testWfParseUrl( $url, $parts ) {
-               $partsDump = var_export( $parts, true );
                $this->assertEquals(
                        $parts,
-                       wfParseUrl( $url ),
-                       "Testing $url parses to $partsDump"
+                       wfParseUrl( $url )
                );
        }
 
@@ -67,6 +69,14 @@ class WfParseUrlTest extends MediaWikiTestCase {
                                        'host' => 'example.org',
                                )
                        ),
+                       array(
+                               'https://example.org',
+                               array(
+                                       'scheme' => 'https',
+                                       'delimiter' => '://',
+                                       'host' => 'example.org',
+                               )
+                       ),
                        array(
                                'http://id:key@example.org:123/path?foo=bar#baz',
                                array(
index b81c973..d36697e 100644 (file)
@@ -155,26 +155,6 @@ class MagicVariableTest extends MediaWikiTestCase {
                $this->assertUnPadded( 'revisionmonth1', $month );
        }
 
-       /**
-        * Rough tests for {{SERVERNAME}} magic word
-        * Bug 31176
-        * @group Database
-        * @dataProvider provideDataServernameFromDifferentProtocols
-        */
-       public function testServernameFromDifferentProtocols( $server ) {
-               $this->setMwGlobals( 'wgServer', $server );
-
-               $this->assertMagic( 'localhost', 'servername' );
-       }
-
-       public static function provideDataServernameFromDifferentProtocols() {
-               return array(
-                       array( 'http://localhost/' ),
-                       array( 'https://localhost/' ),
-                       array( '//localhost/' ), # bug 31176
-               );
-       }
-
        ############### HELPERS ############################################
 
        /** assertion helper expecting a magic output which is zero padded */