Merge "Update tests for PHPUnit 9.6"

This commit is contained in:
jenkins-bot 2023-11-30 23:08:24 +00:00 committed by Gerrit Code Review
commit cdede23c59
2 changed files with 18 additions and 14 deletions

View file

@ -72,11 +72,10 @@ class PopupsGadgetsIntegrationTest extends MediaWikiIntegrationTestCase {
$mock = $this->createMock( Config::class );
$mock->expects( $this->atLeastOnce() )
->method( 'get' )
->withConsecutive(
[ PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME ],
[ PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME ]
)
->willReturn( self::NAV_POPUPS_GADGET_NAME );
->willReturnMap( [
[ PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME, self::NAV_POPUPS_GADGET_NAME ],
[ PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME, self::NAV_POPUPS_GADGET_NAME ],
] );
return $mock;
}
@ -173,11 +172,10 @@ class PopupsGadgetsIntegrationTest extends MediaWikiIntegrationTestCase {
$configMock = $this->createMock( Config::class );
$configMock->expects( $this->atLeastOnce() )
->method( 'get' )
->withConsecutive(
[ PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME ],
[ PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME ]
)
->willReturn( $name );
->willReturnMap( [
[ PopupsGadgetsIntegration::CONFIG_NAVIGATION_POPUPS_NAME, $name ],
[ PopupsGadgetsIntegration::CONFIG_REFERENCE_TOOLTIPS_NAME, $name ]
] );
$gadgetMock = $this->createMock( Gadget::class );
$gadgetMock->expects( $this->once() )

View file

@ -326,12 +326,18 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase {
$userMock = $this->createMock( User::class );
$userOptionsManagerMock = $this->createMock( UserOptionsManager::class );
$expectedOptions = [
'popups' => $expectedState,
'popups-reference-previews' => $expectedState
];
$userOptionsManagerMock->expects( $this->exactly( $enabled ? 2 : 1 ) )
->method( 'setOption' )
->withConsecutive(
[ $userMock, 'popups', $expectedState ],
[ $userMock, 'popups-reference-previews', $expectedState ]
);
->willReturnCallback( function ( $user, $option, $val ) use ( &$expectedOptions, $userMock ) {
$this->assertSame( $userMock, $user );
$this->assertArrayHasKey( $option, $expectedOptions );
$this->assertSame( $expectedOptions[$option], $val );
unset( $expectedOptions[$option] );
} );
$this->setMwGlobals( [
'wgPopupsOptInStateForNewAccounts' => $expectedState,