From fb573fdb2b9c7dfcb76bce6665b6298c556dc4b6 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sat, 7 Sep 2024 12:50:36 +0000 Subject: [PATCH] Use UserFactory::newAnonymous instead of deprecated User::newFromId Change-Id: I4ae99f1118ce23708a07b0dcc69ddba248dafb9f --- tests/phpunit/PopupsHooksTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/PopupsHooksTest.php b/tests/phpunit/PopupsHooksTest.php index 776773c39..d8860f463 100644 --- a/tests/phpunit/PopupsHooksTest.php +++ b/tests/phpunit/PopupsHooksTest.php @@ -246,12 +246,13 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase { $isCodeLoaded, $isTitleExcluded ) { $skinMock = $this->createMock( Skin::class ); + $user = $this->getServiceContainer()->getUserFactory()->newAnonymous(); $outPageMock = $this->createMock( OutputPage::class ); $outPageMock->expects( $isCodeLoaded ? $this->once() : $this->never() ) ->method( 'addModules' ) ->with( [ 'ext.popups' ] ); $outPageMock->method( 'getUser' ) - ->willReturn( User::newFromId( 0 ) ); + ->willReturn( $user ); $contextMock = $this->createMock( PopupsContext::class ); @@ -281,7 +282,7 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase { * @covers ::onMakeGlobalVariablesScript */ public function testOnMakeGlobalVariablesScript() { - $user = User::newFromId( 0 ); + $user = $this->getServiceContainer()->getUserFactory()->newAnonymous(); $outputPage = $this->createMock( OutputPage::class ); $outputPage->method( 'getUser' )