From: umherirrender Date: Wed, 20 Mar 2013 19:10:18 +0000 (+0100) Subject: MagicVariableTest.php: Use dataProvider X-Git-Tag: 1.31.0-rc.0~20269^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=817d4fc55ba1d921d1757a96268b3ac20cc22e6c;hp=efc9adf4e5bf7547af28999e64309d18ea867463;p=lhc%2Fweb%2Fwiklou.git MagicVariableTest.php: Use dataProvider Setting a global 3 times in one test method looks weird Change-Id: I97f6a932ee2d5c9a5e427cf0f40ced730b7e12ec --- diff --git a/tests/phpunit/includes/parser/MagicVariableTest.php b/tests/phpunit/includes/parser/MagicVariableTest.php index 51643ce4e3..75e1fd1ced 100644 --- a/tests/phpunit/includes/parser/MagicVariableTest.php +++ b/tests/phpunit/includes/parser/MagicVariableTest.php @@ -172,19 +172,20 @@ class MagicVariableTest extends MediaWikiTestCase { * Rough tests for {{SERVERNAME}} magic word * Bug 31176 * @group Database + * @dataProvider dataServernameFromDifferentProtocols */ - function testServernameFromDifferentProtocols() { - global $wgServer; - $saved_wgServer = $wgServer; + function testServernameFromDifferentProtocols( $server ) { + $this->setMwGlobals( 'wgServer', $server ); - $wgServer = 'http://localhost/'; - $this->assertMagic( 'localhost', 'servername' ); - $wgServer = 'https://localhost/'; - $this->assertMagic( 'localhost', 'servername' ); - $wgServer = '//localhost/'; # bug 31176 $this->assertMagic( 'localhost', 'servername' ); + } - $wgServer = $saved_wgServer; + function dataServernameFromDifferentProtocols() { + return array( + array( 'http://localhost/' ), + array( 'https://localhost/' ), + array( '//localhost/' ), # bug 31176 + ); } ############### HELPERS ############################################