2018-11-04 15:15:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace CookieWarning\Tests;
|
|
|
|
|
|
|
|
use CookieWarning\HttpGeoLocation;
|
|
|
|
use CookieWarning\NoopGeoLocation;
|
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() {
|
2024-07-27 07:21:32 +00:00
|
|
|
$this->overrideConfigValues( [
|
|
|
|
'CookieWarningGeoIPServiceURL' => null
|
2018-11-04 15:15:42 +00:00
|
|
|
] );
|
|
|
|
|
2024-07-27 07:40:08 +00:00
|
|
|
$geoLocation = $this->getServiceContainer()->getService( 'GeoLocation' );
|
2018-11-04 15:15:42 +00:00
|
|
|
|
|
|
|
$this->assertInstanceOf( NoopGeoLocation::class, $geoLocation );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \CookieWarning\HttpGeoLocation
|
|
|
|
*/
|
|
|
|
public function testGeoLocationWithServiceURL() {
|
2024-07-27 07:21:32 +00:00
|
|
|
$this->overrideConfigValues( [
|
|
|
|
'CookieWarningGeoIPServiceURL' => 'http://localhost/'
|
2018-11-04 15:15:42 +00:00
|
|
|
] );
|
|
|
|
|
2024-07-27 07:40:08 +00:00
|
|
|
$geoLocation = $this->getServiceContainer()->getService( 'GeoLocation' );
|
2018-11-04 15:15:42 +00:00
|
|
|
|
|
|
|
$this->assertInstanceOf( HttpGeoLocation::class, $geoLocation );
|
|
|
|
}
|
|
|
|
}
|