Matěj Suchánek has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/352119 )
Change subject: Don't use globals in EchoNotificationsHandlersTestCase
......................................................................
Don't use globals in EchoNotificationsHandlersTestCase
Change-Id: I1bd11b551c0243a26fe39538604b6633a590ec59
---
M client/tests/phpunit/includes/Hooks/EchoNotificationsHandlersTest.php
1 file changed, 16 insertions(+), 23 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/19/352119/1
diff --git
a/client/tests/phpunit/includes/Hooks/EchoNotificationsHandlersTest.php
b/client/tests/phpunit/includes/Hooks/EchoNotificationsHandlersTest.php
index 811e66b..337b814 100644
--- a/client/tests/phpunit/includes/Hooks/EchoNotificationsHandlersTest.php
+++ b/client/tests/phpunit/includes/Hooks/EchoNotificationsHandlersTest.php
@@ -159,69 +159,62 @@
}
public function testBeforeCreateEchoEvent() {
- global $wgEchoNotifications, $wgEchoNotificationCategories,
$wgEchoNotificationIcons;
$settings = new SettingsArray();
$settings->setSetting( 'siteGlobalID', 'enwiki' );
$settings->setSetting( 'sendEchoNotification', false );
$settings->setSetting( 'echoIcon', false );
+ $notifications = [];
+ $categories = [];
+ $icons = [];
+
$handlers = $this->getHandlers( $settings );
- $handlers->doBeforeCreateEchoEvent(
- $wgEchoNotifications, $wgEchoNotificationCategories,
$wgEchoNotificationIcons
- );
+ $handlers->doBeforeCreateEchoEvent( $notifications,
$categories, $icons );
$this->assertFalse(
- isset(
$wgEchoNotifications[$handlers::NOTIFICATION_TYPE] ),
+ isset( $notifications[$handlers::NOTIFICATION_TYPE] ),
"Failed asserting that the notification type is
registered to Echo"
);
$settings->setSetting( 'sendEchoNotification', true );
$handlers = $this->getHandlers( $settings );
- $handlers->doBeforeCreateEchoEvent(
- $wgEchoNotifications, $wgEchoNotificationCategories,
$wgEchoNotificationIcons
- );
+ $handlers->doBeforeCreateEchoEvent( $notifications,
$categories, $icons );
$this->assertArrayHasKey(
$handlers::NOTIFICATION_TYPE,
- $wgEchoNotifications,
+ $notifications,
"Failed asserting that the notification type is
registered to Echo"
);
$this->assertArrayHasKey(
'wikibase-action',
- $wgEchoNotificationCategories,
+ $categories,
"Failed asserting that the notification category is
registered to Echo"
);
$this->assertArrayHasKey(
$handlers::NOTIFICATION_TYPE,
- $wgEchoNotificationIcons,
+ $icons,
"Failed asserting that the notification icon is
registered to Echo"
);
$this->assertEquals(
[ 'path' =>
'Wikibase/client/includes/Hooks/../../resources/images/echoIcon.svg' ],
- $wgEchoNotificationIcons[$handlers::NOTIFICATION_TYPE],
+ $icons[$handlers::NOTIFICATION_TYPE],
"Failed asserting that missing echoIcon setting
defaults to Echo's default"
);
- unset( $wgEchoNotifications[$handlers::NOTIFICATION_TYPE] );
- unset( $wgEchoNotificationCategories['wikibase-action'] );
- unset( $wgEchoNotificationIcons[$handlers::NOTIFICATION_TYPE] );
+ $notifications = [];
+ $categories = [];
+ $icons = [];
$echoIcon = [ 'url' => 'some_url_here' ];
$settings->setSetting( 'echoIcon', $echoIcon );
$handlers = $this->getHandlers( $settings );
- $handlers->doBeforeCreateEchoEvent(
- $wgEchoNotifications, $wgEchoNotificationCategories,
$wgEchoNotificationIcons
- );
+ $handlers->doBeforeCreateEchoEvent( $notifications,
$categories, $icons );
$this->assertEquals(
$echoIcon,
- $wgEchoNotificationIcons[$handlers::NOTIFICATION_TYPE],
+ $icons[$handlers::NOTIFICATION_TYPE],
"Failed asserting that the notification icon is
correctly registered to Echo"
);
-
- unset( $wgEchoNotifications[$handlers::NOTIFICATION_TYPE] );
- unset( $wgEchoNotificationCategories['wikibase-action'] );
- unset( $wgEchoNotificationIcons[$handlers::NOTIFICATION_TYPE] );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/352119
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bd11b551c0243a26fe39538604b6633a590ec59
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits