diff --git a/lib/Cron/Workers/StatsNotifications/Scheduler.php b/lib/Cron/Workers/StatsNotifications/Scheduler.php index a802687b07..a6d15a1bc3 100644 --- a/lib/Cron/Workers/StatsNotifications/Scheduler.php +++ b/lib/Cron/Workers/StatsNotifications/Scheduler.php @@ -92,7 +92,7 @@ class Scheduler { } private function isTaskScheduled($newsletter_id) { - $existing = $this->repository->findAllForNewsletter($newsletter_id); + $existing = $this->repository->findByNewsletterId($newsletter_id); return count($existing) > 0; } diff --git a/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php b/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php index 8ca8dd07e1..4742a3a8c0 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[] */ - public function findAllForNewsletter($newsletter_id) { + public function findByNewsletterId($newsletter_id) { return $this->doctrine_repository ->createQueryBuilder('stn') ->join('stn.task', 'tasks') diff --git a/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php b/tests/unit/Cron/Workers/StatsNotifications/SchedulerTest.php index 0ff5a8a859..e372a27ac0 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('findAllForNewsletter') + ->method('findByNewsletterId') ->with($newsletter_id) ->willReturn([]); @@ -108,7 +108,7 @@ class SchedulerTest extends \MailPoetUnitTest { $this->repository ->expects($this->once()) - ->method('findAllForNewsletter') + ->method('findByNewsletterId') ->with($newsletter_id) ->willReturn([]); @@ -230,7 +230,7 @@ class SchedulerTest extends \MailPoetUnitTest { $this->repository ->expects($this->once()) - ->method('findAllForNewsletter') + ->method('findByNewsletterId') ->with($newsletter_id) ->willReturn([new ScheduledTaskEntity()]); $this->entityManager