diff --git a/extension.json b/extension.json index 2184ffc80..33d84feba 100644 --- a/extension.json +++ b/extension.json @@ -1009,7 +1009,7 @@ "MWEchoThankYouEditTest": "tests/phpunit/ThankYouEditTest.php", "NotificationControllerTest": "tests/phpunit/controller/NotificationControllerTest.php", "NotificationPager": "includes/special/NotificationPager.php", - "NotificationsTest": "tests/NotificationsTest.php", + "NotificationsTest": "tests/phpunit/NotificationsTest.php", "ProcessEchoEmailBatch": "maintenance/processEchoEmailBatch.php", "RemoveInvalidNotification": "maintenance/removeInvalidNotification.php", "RemoveOrphanedEvents": "maintenance/removeOrphanedEvents.php", diff --git a/tests/NotificationsTest.php b/tests/phpunit/NotificationsTest.php similarity index 84% rename from tests/NotificationsTest.php rename to tests/phpunit/NotificationsTest.php index cc7ddfe6b..641e6bd01 100644 --- a/tests/NotificationsTest.php +++ b/tests/phpunit/NotificationsTest.php @@ -24,14 +24,15 @@ class NotificationsTest extends MediaWikiTestCase { * @return EchoEvent */ public static function getLatestNotification( $user ) { - $notifs = ApiEchoNotifications::getNotifications( $user ); - $index = array_keys( $notifs ); + $notifMapper = new EchoNotificationMapper(); + $notifs = $notifMapper->fetchUnreadByUser( $user, 1, '', [ 'user-rights' ] ); + $notif = array_pop( $notifs ); - return EchoEvent::newFromID( $notifs[$index[0]]['id'] ); + return $notif->getEvent(); } /** - * @covers EchoHooks::onUserRights + * @covers EchoHooks::onUserGroupsChanged */ public function testUserRightsNotif() { $user = new User();