Merge "Use UserFactory::newAnonymous instead of deprecated User::newFromId"

This commit is contained in:
jenkins-bot 2024-09-09 20:36:59 +00:00 committed by Gerrit Code Review
commit e358e38591

View file

@ -246,12 +246,13 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase {
$isCodeLoaded, $isTitleExcluded ) { $isCodeLoaded, $isTitleExcluded ) {
$skinMock = $this->createMock( Skin::class ); $skinMock = $this->createMock( Skin::class );
$user = $this->getServiceContainer()->getUserFactory()->newAnonymous();
$outPageMock = $this->createMock( OutputPage::class ); $outPageMock = $this->createMock( OutputPage::class );
$outPageMock->expects( $isCodeLoaded ? $this->once() : $this->never() ) $outPageMock->expects( $isCodeLoaded ? $this->once() : $this->never() )
->method( 'addModules' ) ->method( 'addModules' )
->with( [ 'ext.popups' ] ); ->with( [ 'ext.popups' ] );
$outPageMock->method( 'getUser' ) $outPageMock->method( 'getUser' )
->willReturn( User::newFromId( 0 ) ); ->willReturn( $user );
$contextMock = $this->createMock( PopupsContext::class ); $contextMock = $this->createMock( PopupsContext::class );
@ -281,7 +282,7 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase {
* @covers ::onMakeGlobalVariablesScript * @covers ::onMakeGlobalVariablesScript
*/ */
public function testOnMakeGlobalVariablesScript() { public function testOnMakeGlobalVariablesScript() {
$user = User::newFromId( 0 ); $user = $this->getServiceContainer()->getUserFactory()->newAnonymous();
$outputPage = $this->createMock( OutputPage::class ); $outputPage = $this->createMock( OutputPage::class );
$outputPage->method( 'getUser' ) $outputPage->method( 'getUser' )