mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-12-11 22:06:09 +00:00
38 lines
904 B
PHP
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 );
|
||
|
}
|
||
|
}
|