Use overrideConfigValues instead of setMwGlobals

Also use MainConfigNames.

Change-Id: I4255b89b8f34fffe5bc70e73dfe7e9b6a4d69941
This commit is contained in:
Fomafix 2024-07-27 07:21:32 +00:00
parent d1b64431e9
commit 30e24aa1b0
3 changed files with 16 additions and 16 deletions

View file

@ -19,10 +19,10 @@ class DecisionsTest extends MediaWikiIntegrationTestCase {
* @throws MWException
*/
public function testShouldNotCallGeoLocationMultiple() {
$this->setMwGlobals( [
'wgCookieWarningEnabled' => true,
'wgCookieWarningGeoIPLookup' => 'php',
'wgCookieWarningForCountryCodes' => [ 'EU' => 'European Union' ],
$this->overrideConfigValues( [
'CookieWarningEnabled' => true,
'CookieWarningGeoIPLookup' => 'php',
'CookieWarningForCountryCodes' => [ 'EU' => 'European Union' ],
] );
$geoLocation = $this->getMockBuilder( GeoLocation::class )

View file

@ -35,10 +35,10 @@ class HooksTest extends MediaWikiLangTestCase {
$morelinkCookiePolicyMsg,
$expectedLink
): void {
$this->setMwGlobals( [
'wgCookieWarningEnabled' => $enabled,
'wgCookieWarningMoreUrl' => $morelinkConfig,
'wgCookieWarningForCountryCodes' => false,
$this->overrideConfigValues( [
'CookieWarningEnabled' => $enabled,
'CookieWarningMoreUrl' => $morelinkConfig,
'CookieWarningForCountryCodes' => false,
] );
MediaWikiServices::getInstance()->getMessageCache()->enable();
@ -165,10 +165,10 @@ class HooksTest extends MediaWikiLangTestCase {
public function testOnSiteNoticeAfterGeoLocation( $ipAddress, $countryCodes,
$expected
) {
$this->setMwGlobals( [
'wgCookieWarningEnabled' => true,
'wgCookieWarningGeoIPLookup' => is_array( $countryCodes ) ? 'php' : 'none',
'wgCookieWarningForCountryCodes' => $countryCodes,
$this->overrideConfigValues( [
'CookieWarningEnabled' => true,
'CookieWarningGeoIPLookup' => is_array( $countryCodes ) ? 'php' : 'none',
'CookieWarningForCountryCodes' => $countryCodes,
] );
$this->mockGeoLocationService();

View file

@ -13,8 +13,8 @@ class ServiceWiringTest extends MediaWikiIntegrationTestCase {
* @covers \CookieWarning\NoopGeoLocation
*/
public function testGeoLocationWithoutServiceURL() {
$this->setMwGlobals( [
'wgCookieWarningGeoIPServiceURL' => null
$this->overrideConfigValues( [
'CookieWarningGeoIPServiceURL' => null
] );
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );
@ -26,8 +26,8 @@ class ServiceWiringTest extends MediaWikiIntegrationTestCase {
* @covers \CookieWarning\HttpGeoLocation
*/
public function testGeoLocationWithServiceURL() {
$this->setMwGlobals( [
'wgCookieWarningGeoIPServiceURL' => 'http://localhost/'
$this->overrideConfigValues( [
'CookieWarningGeoIPServiceURL' => 'http://localhost/'
] );
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );