Skip to content

Commit ddfd835

Browse files
committed
IBX-9060: Added test for marking multiple user notifications as read using IDs
1 parent 667e9fe commit ddfd835

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

tests/integration/Core/Repository/NotificationServiceTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ public function testMarkUserNotificationsAsRead(): void
8383
self::assertEquals(0, $pendingCountAfter);
8484
}
8585

86+
public function testMarkUserNotificationsAsReadWithIds(): void
87+
{
88+
$repository = $this->getRepository();
89+
$notificationService = $repository->getNotificationService();
90+
91+
$notifications = $notificationService->loadNotifications(0, 2)->items;
92+
self::assertCount(2, $notifications, 'This test requires exactly 2 notifications.');
93+
94+
$idsToMarkAsRead = array_column($notifications, 'id');
95+
96+
foreach ($notifications as $notification) {
97+
self::assertTrue($notification->isPending, "Notification ID {$notification->id} should initially be pending.");
98+
}
99+
100+
$notificationService->markUserNotificationsAsRead($idsToMarkAsRead);
101+
102+
$updatedNotifications = $notificationService->loadNotifications(0, 2)->items;
103+
104+
foreach ($updatedNotifications as $notification) {
105+
self::assertFalse($notification->isPending, "Notification ID {$notification->id} should be marked as read.");
106+
}
107+
}
108+
86109
public function testMarkNotificationAsRead(): void
87110
{
88111
$repository = $this->getRepository();

tests/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabaseTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,4 @@ public function testBulkUpdateUserNotifications(): void
287287
}
288288
}
289289

290-
class_alias(
291-
DoctrineDatabaseTest::class,
292-
'eZ\Publish\Core\Persistence\Legacy\Tests\Notification\Gateway\DoctrineDatabaseTest'
293-
);
290+
class_alias(DoctrineDatabaseTest::class, 'eZ\Publish\Core\Persistence\Legacy\Tests\Notification\Gateway\DoctrineDatabaseTest');

0 commit comments

Comments
 (0)