2018-11-04 15:15:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace CookieWarning\Tests;
|
|
|
|
|
|
|
|
use CookieWarning\HttpGeoLocation;
|
|
|
|
use CookieWarning\NoopGeoLocation;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
2021-10-12 19:30:58 +00:00
|
|
|
use MediaWikiIntegrationTestCase;
|
2018-11-04 15:15:42 +00:00
|
|
|
|
2021-10-12 19:30:58 +00:00
|
|
|
class ServiceWiringTest extends MediaWikiIntegrationTestCase {
|
2018-11-04 15:15:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 );
|
|
|
|
}
|
|
|
|
}
|