Better method name

[MAILPOET-2439]
This commit is contained in:
Pavel Dohnal
2019-10-31 10:32:37 +01:00
committed by Jack Kitterhing
parent ab1e398241
commit 1418abbdb1
3 changed files with 5 additions and 5 deletions

View File

@ -92,7 +92,7 @@ class Scheduler {
} }
private function hasTaskBeenScheduled($newsletter_id) { private function hasTaskBeenScheduled($newsletter_id) {
$existing = $this->repository->findByNewsletterId($newsletter_id); $existing = $this->repository->findOneByNewsletterId($newsletter_id);
return $existing instanceof StatsNotificationEntity; return $existing instanceof StatsNotificationEntity;
} }

View File

@ -17,7 +17,7 @@ class StatsNotificationsRepository extends Repository {
* @param int $newsletter_id * @param int $newsletter_id
* @return StatsNotificationEntity|null * @return StatsNotificationEntity|null
*/ */
public function findByNewsletterId($newsletter_id) { public function findOneByNewsletterId($newsletter_id) {
return $this->doctrine_repository return $this->doctrine_repository
->createQueryBuilder('sn') ->createQueryBuilder('sn')
->andWhere('sn.newsletter = :newsletterId') ->andWhere('sn.newsletter = :newsletterId')

View File

@ -68,7 +68,7 @@ class SchedulerTest extends \MailPoetUnitTest {
$this->repository $this->repository
->expects($this->once()) ->expects($this->once())
->method('findByNewsletterId') ->method('findOneByNewsletterId')
->with($newsletter_id) ->with($newsletter_id)
->willReturn([]); ->willReturn([]);
@ -108,7 +108,7 @@ class SchedulerTest extends \MailPoetUnitTest {
$this->repository $this->repository
->expects($this->once()) ->expects($this->once())
->method('findByNewsletterId') ->method('findOneByNewsletterId')
->with($newsletter_id) ->with($newsletter_id)
->willReturn([]); ->willReturn([]);
@ -230,7 +230,7 @@ class SchedulerTest extends \MailPoetUnitTest {
$this->repository $this->repository
->expects($this->once()) ->expects($this->once())
->method('findByNewsletterId') ->method('findOneByNewsletterId')
->with($newsletter_id) ->with($newsletter_id)
->willReturn(new StatsNotificationEntity(new NewsletterEntity(), new ScheduledTaskEntity())); ->willReturn(new StatsNotificationEntity(new NewsletterEntity(), new ScheduledTaskEntity()));
$this->entityManager $this->entityManager