wiki.techinc.nl/tests/phpunit/includes/http/HttpTest.php
Thiemo Kreuz e06ce9f467 tests: Prefer PHPUnit's assertSame() when comparing empty strings
assertSame() is guaranteed to never do any magic type conversion.
This can be critical when accidentially comparing empty strings (a
value PHP considers to be "falsy") to false, 0, 0.0, null, and such.

Change-Id: I2e2685c5992cae252f629a68ffe1a049f2e5ed1b
2019-09-20 15:27:58 +00:00

30 lines
483 B
PHP

<?php
/**
* @covers Http
* @group Http
* @group small
*/
class HttpTest extends MediaWikiTestCase {
/**
* @covers Http::getProxy
*/
public function testGetProxy() {
$this->hideDeprecated( 'Http::getProxy' );
$this->setMwGlobals( 'wgHTTPProxy', false );
$this->assertSame(
'',
Http::getProxy(),
'default setting'
);
$this->setMwGlobals( 'wgHTTPProxy', 'proxy.domain.tld' );
$this->assertEquals(
'proxy.domain.tld',
Http::getProxy()
);
}
}