File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
integration/Core/Repository
lib/Persistence/Legacy/Notification/Gateway Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff 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 ' );
You can’t perform that action at this time.
0 commit comments