diff --git a/lib/Cron/Workers/StatsNotifications/Scheduler.php b/lib/Cron/Workers/StatsNotifications/Scheduler.php index 879476f62b..378a83ce44 100644 --- a/lib/Cron/Workers/StatsNotifications/Scheduler.php +++ b/lib/Cron/Workers/StatsNotifications/Scheduler.php @@ -92,7 +92,7 @@ class Scheduler { } private function hasTaskBeenScheduled($newsletter_id) { - $existing = $this->repository->findByNewsletterId($newsletter_id); + $existing = $this->repository->findOneByNewsletterId($newsletter_id); return $existing instanceof StatsNotificationEntity; } diff --git a/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php b/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php index 76ffd4b52b..af74ad7a09 100644 --- a/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php +++ b/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php @@ -17,7 +17,7 @@ class StatsNotificationsRepository extends Repository { * @param int $newsletter_id * @return StatsNotificationEntity|null */ - public function findByNewsletterId($newsletter_id) { + public function findOneByNewsletterId($newsletter_id) { return $this->doctrine_repository ->createQueryBuilder('sn') ->andWhere('sn.newsletter = :newsletterId') diff --git a/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php b/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php index 301eff4cac..8ed514cfed 100644 --- a/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php +++ b/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php @@ -68,7 +68,7 @@ class SchedulerTest extends \MailPoetUnitTest { $this->repository ->expects($this->once()) - ->method('findByNewsletterId') + ->method('findOneByNewsletterId') ->with($newsletter_id) ->willReturn([]); @@ -108,7 +108,7 @@ class SchedulerTest extends \MailPoetUnitTest { $this->repository ->expects($this->once()) - ->method('findByNewsletterId') + ->method('findOneByNewsletterId') ->with($newsletter_id) ->willReturn([]); @@ -230,7 +230,7 @@ class SchedulerTest extends \MailPoetUnitTest { $this->repository ->expects($this->once()) - ->method('findByNewsletterId') + ->method('findOneByNewsletterId') ->with($newsletter_id) ->willReturn(new StatsNotificationEntity(new NewsletterEntity(), new ScheduledTaskEntity())); $this->entityManager