Use $this->getServiceContainer() in test cases

Change-Id: Ic03f4d692720cd9810c44700f7bf27d1cf07d26d
This commit is contained in:
Fomafix 2022-11-05 09:50:56 +00:00
parent 56d8a8df55
commit c58f9234fc

View file

@ -19,7 +19,6 @@
* @ingroup extensions
*/
use MediaWiki\MediaWikiServices;
use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls;
use Popups\PopupsContext;
use Popups\PopupsGadgetsIntegration;
@ -50,7 +49,7 @@ class PopupsContextTest extends MediaWikiIntegrationTestCase {
$integration->method( 'conflictsWithNavPopupsGadget' )
->willReturn( false );
}
$services = MediaWikiServices::getInstance();
$services = $this->getServiceContainer();
return new PopupsContext(
$config,
$registry,
@ -121,7 +120,7 @@ class PopupsContextTest extends MediaWikiIntegrationTestCase {
$context = $this->getContext();
$user = $this->getMutableTestUser()->getUser();
$userOptionsManager = MediaWikiServices::getInstance()->getUserOptionsManager();
$userOptionsManager = $this->getServiceContainer()->getUserOptionsManager();
$userOptionsManager->setOption( $user, PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, $optIn );
$this->assertSame( $expected,
$context->shouldSendModuleToUser( $user ),