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 <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
This commit is contained in:
Timo Tijhof 2014-06-24 21:20:01 +02:00
parent 480546006c
commit 0c2a013beb
2 changed files with 14 additions and 24 deletions

View 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(

View 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 */