mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-11-23 22:03:41 +00:00
Use $this->getServiceContainer() in tests
Change-Id: I7139a34a6373edd8bd6f42d8716260ef2164e8de
This commit is contained in:
parent
30e24aa1b0
commit
156193fe88
|
@ -6,7 +6,6 @@ use ConfigException;
|
|||
use CookieWarning\Decisions;
|
||||
use CookieWarning\GeoLocation;
|
||||
use HashBagOStuff;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use MWException;
|
||||
use RequestContext;
|
||||
|
@ -32,10 +31,10 @@ class DecisionsTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$geoLocation->expects( $this->once() )->method( 'locate' );
|
||||
$cookieWarningDecisions = new Decisions(
|
||||
MediaWikiServices::getInstance()->getService( 'CookieWarning.Config' ),
|
||||
$this->getServiceContainer()->getService( 'CookieWarning.Config' ),
|
||||
$geoLocation,
|
||||
new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ),
|
||||
MediaWikiServices::getInstance()->getUserOptionsLookup()
|
||||
$this->getServiceContainer()->getUserOptionsLookup()
|
||||
);
|
||||
|
||||
$cookieWarningDecisions->shouldShowCookieWarning( RequestContext::getMain() );
|
||||
|
|
|
@ -6,7 +6,6 @@ use CookieWarning\GeoLocation;
|
|||
use CookieWarning\Hooks;
|
||||
use DerivativeContext;
|
||||
use FauxRequest;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWikiLangTestCase;
|
||||
use RequestContext;
|
||||
use SkinTemplate;
|
||||
|
@ -40,7 +39,7 @@ class HooksTest extends MediaWikiLangTestCase {
|
|||
'CookieWarningMoreUrl' => $morelinkConfig,
|
||||
'CookieWarningForCountryCodes' => false,
|
||||
] );
|
||||
MediaWikiServices::getInstance()->getMessageCache()->enable();
|
||||
$this->getServiceContainer()->getMessageCache()->enable();
|
||||
|
||||
if ( $morelinkCookieWarningMsg ) {
|
||||
$this->editPage(
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace CookieWarning\Tests;
|
|||
|
||||
use CookieWarning\HttpGeoLocation;
|
||||
use CookieWarning\NoopGeoLocation;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
|
||||
class ServiceWiringTest extends MediaWikiIntegrationTestCase {
|
||||
|
@ -17,7 +16,7 @@ class ServiceWiringTest extends MediaWikiIntegrationTestCase {
|
|||
'CookieWarningGeoIPServiceURL' => null
|
||||
] );
|
||||
|
||||
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );
|
||||
$geoLocation = $this->getServiceContainer()->getService( 'GeoLocation' );
|
||||
|
||||
$this->assertInstanceOf( NoopGeoLocation::class, $geoLocation );
|
||||
}
|
||||
|
@ -30,7 +29,7 @@ class ServiceWiringTest extends MediaWikiIntegrationTestCase {
|
|||
'CookieWarningGeoIPServiceURL' => 'http://localhost/'
|
||||
] );
|
||||
|
||||
$geoLocation = MediaWikiServices::getInstance()->getService( 'GeoLocation' );
|
||||
$geoLocation = $this->getServiceContainer()->getService( 'GeoLocation' );
|
||||
|
||||
$this->assertInstanceOf( HttpGeoLocation::class, $geoLocation );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue