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

Change-Id: I4ae99f1118ce23708a07b0dcc69ddba248dafb9f
This commit is contained in:
Fomafix 2024-09-07 12:50:36 +00:00
parent 7a79602208
commit fb573fdb2b

View file

@ -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' )