mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Merge "Update tests for PHPUnit 9.6"
This commit is contained in:
commit
cdede23c59
|
@ -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() )
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue