setMwGlobals( [ 'wgCookieWarningEnabled' => true, 'wgCookieWarningGeoIPLookup' => 'php', 'wgCookieWarningForCountryCodes' => [ 'EU' => 'European Union' ], ] ); $geoLocation = $this->getMockBuilder( GeoLocation::class ) ->disableOriginalConstructor() ->getMock(); $geoLocation->method( 'locate' )->willReturn( 'EU' ); $geoLocation->expects( $this->once() )->method( 'locate' ); $cookieWarningDecisions = new Decisions( MediaWikiServices::getInstance()->getService( 'CookieWarning.Config' ), $geoLocation, new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ), MediaWikiServices::getInstance()->getUserOptionsLookup() ); $cookieWarningDecisions->shouldShowCookieWarning( RequestContext::getMain() ); $cookieWarningDecisions->shouldShowCookieWarning( RequestContext::getMain() ); } }