mediawiki-extensions-Cookie.../tests/phpunit/includes/ServiceWiringTest.php
Florian Schmidt 6634e8c829 Enable GeoLocation service being replaced by other providers
Making GeoLocation an interface makes it easier to replace the underlying implementation
from the current Http backed method.

Change-Id: I2beb97772fd74ab08b2214c08d82dbc1ebfcdcd2
2019-11-21 17:31:23 +01:00

38 lines
904 B
PHP

<?php
namespace CookieWarning\Tests;
use CookieWarning\HttpGeoLocation;
use CookieWarning\NoopGeoLocation;
use MediaWiki\MediaWikiServices;
use MediaWikiTestCase;
class ServiceWiringTest extends MediaWikiTestCase {
/**
* @covers \CookieWarning\NoopGeoLocation
*/
public function testGeoLocationWithoutServiceURL() {
$this->setMwGlobals( [
'wgCookieWarningGeoIPServiceURL' => null
] );
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );
$this->assertInstanceOf( NoopGeoLocation::class, $geoLocation );
}
/**
* @covers \CookieWarning\HttpGeoLocation
*/
public function testGeoLocationWithServiceURL() {
$this->setMwGlobals( [
'wgCookieWarningGeoIPServiceURL' => 'http://localhost/'
] );
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );
$this->assertInstanceOf( HttpGeoLocation::class, $geoLocation );
}
}