From: Timo Tijhof Date: Tue, 24 Jun 2014 19:20:01 +0000 (+0200) Subject: test: Remove MagicVariableTest#testServernameFromDifferentProtocols X-Git-Tag: 1.31.0-rc.0~15231^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=0c2a013beb3933dd0475f1d34a7800372100ab1d;p=lhc%2Fweb%2Fwiklou.git test: Remove MagicVariableTest#testServernameFromDifferentProtocols 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 > 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 --- diff --git a/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php index 5032dc11ad..af834f8dc4 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfParseUrlTest.php @@ -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( diff --git a/tests/phpunit/includes/parser/MagicVariableTest.php b/tests/phpunit/includes/parser/MagicVariableTest.php index b81c973ae6..d36697eb15 100644 --- a/tests/phpunit/includes/parser/MagicVariableTest.php +++ b/tests/phpunit/includes/parser/MagicVariableTest.php @@ -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 */