mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-11-30 17:04:32 +00:00
5ac97cf126
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34. Bug: T293043 Change-Id: I92d2b29501214f00e77c92149038b19d937dcabe
38 lines
926 B
PHP
38 lines
926 B
PHP
<?php
|
|
|
|
namespace CookieWarning\Tests;
|
|
|
|
use CookieWarning\HttpGeoLocation;
|
|
use CookieWarning\NoopGeoLocation;
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
class ServiceWiringTest extends MediaWikiIntegrationTestCase {
|
|
|
|
/**
|
|
* @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 );
|
|
}
|
|
}
|