Move NotificationsTest to tests/phpunit

Under this folder the test is run automatically on CI or
phpunit.php --testsuite extensions

Change-Id: I5e466c04fc5c827883882f798ba0e41d6990e423
This commit is contained in:
Umherirrender 2018-04-24 21:46:31 +02:00
parent ee01b6db89
commit 43820a6390
2 changed files with 6 additions and 5 deletions

View file

@ -1009,7 +1009,7 @@
"MWEchoThankYouEditTest": "tests/phpunit/ThankYouEditTest.php", "MWEchoThankYouEditTest": "tests/phpunit/ThankYouEditTest.php",
"NotificationControllerTest": "tests/phpunit/controller/NotificationControllerTest.php", "NotificationControllerTest": "tests/phpunit/controller/NotificationControllerTest.php",
"NotificationPager": "includes/special/NotificationPager.php", "NotificationPager": "includes/special/NotificationPager.php",
"NotificationsTest": "tests/NotificationsTest.php", "NotificationsTest": "tests/phpunit/NotificationsTest.php",
"ProcessEchoEmailBatch": "maintenance/processEchoEmailBatch.php", "ProcessEchoEmailBatch": "maintenance/processEchoEmailBatch.php",
"RemoveInvalidNotification": "maintenance/removeInvalidNotification.php", "RemoveInvalidNotification": "maintenance/removeInvalidNotification.php",
"RemoveOrphanedEvents": "maintenance/removeOrphanedEvents.php", "RemoveOrphanedEvents": "maintenance/removeOrphanedEvents.php",

View file

@ -24,14 +24,15 @@ class NotificationsTest extends MediaWikiTestCase {
* @return EchoEvent * @return EchoEvent
*/ */
public static function getLatestNotification( $user ) { public static function getLatestNotification( $user ) {
$notifs = ApiEchoNotifications::getNotifications( $user ); $notifMapper = new EchoNotificationMapper();
$index = array_keys( $notifs ); $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() { public function testUserRightsNotif() {
$user = new User(); $user = new User();