mediawiki-extensions-Cookie.../tests/phpunit/includes/ServiceWiringTest.php
Fomafix 156193fe88 Use $this->getServiceContainer() in tests
Change-Id: I7139a34a6373edd8bd6f42d8716260ef2164e8de
2024-07-27 07:40:58 +00:00

37 lines
897 B
PHP

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