bulkNotification = static::getContainer()->get('mautic.integrations.sync.notification.bulk_notification'); } public function testNotifications(): void { $notificationRepository = $this->em->getRepository(Notification::class); $this->bulkNotification->addNotification('dup1', 'message 1', 'Integration name', 'Lead', 'lead', 0, 'link 1'); $this->bulkNotification->addNotification('dup2', 'message 2', 'Integration name', 'Lead', 'lead', 0, 'link 2'); $this->bulkNotification->addNotification('dup1', 'message 3', 'Integration name', 'Lead', 'lead', 0, 'link 3'); Assert::assertCount(0, $notificationRepository->findAll()); $this->bulkNotification->flush(); $notifications = $notificationRepository->findAll(); Assert::assertCount(2, $notifications); $this->assertNotification($notifications[0], 'message 1', 'link 1'); $this->assertNotification($notifications[1], 'message 2', 'link 2'); } private function assertNotification(Notification $notification, string $message, string $link): void { Assert::assertSame(sprintf('%s failed to sync with message, "%s"', $link, $message), $notification->getMessage()); } }