diff --git a/tests/phpunit/includes/DecisionsTest.php b/tests/phpunit/includes/DecisionsTest.php index 5fb9949..ee19be2 100644 --- a/tests/phpunit/includes/DecisionsTest.php +++ b/tests/phpunit/includes/DecisionsTest.php @@ -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() ); diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 523b737..460f9d1 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -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( diff --git a/tests/phpunit/includes/ServiceWiringTest.php b/tests/phpunit/includes/ServiceWiringTest.php index f0f0f0f..c1c9654 100644 --- a/tests/phpunit/includes/ServiceWiringTest.php +++ b/tests/phpunit/includes/ServiceWiringTest.php @@ -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 ); }