Allow fetching count of subscribers with status
[MAILPOET-3077]
This commit is contained in:
committed by
Veljko V
parent
694d1fae10
commit
cd295c7aec
@ -46,6 +46,8 @@ class SegmentSubscribersRepositoryTest extends \MailPoetTest {
|
||||
$this->entityManager->flush();
|
||||
|
||||
$count = $this->repository->getSubscribersCount((int)$segment->getId());
|
||||
expect($count)->equals(3);
|
||||
$count = $this->repository->getSubscribersCount((int)$segment->getId(), SubscriberEntity::STATUS_SUBSCRIBED);
|
||||
expect($count)->equals(1);
|
||||
$ids = $this->repository->getSubscriberIdsInSegment((int)$segment->getId());
|
||||
expect($ids)->equals([$subscriberInSegment->getId()]);
|
||||
@ -70,11 +72,17 @@ class SegmentSubscribersRepositoryTest extends \MailPoetTest {
|
||||
->getRepository(SubscriberEntity::class)
|
||||
->findOneBy(['email' => $wpUserEmail]);
|
||||
assert($wpUserSubscriber instanceof SubscriberEntity);
|
||||
$wpUserSubscriber->setStatus(SubscriberEntity::STATUS_SUBSCRIBED);
|
||||
assert($wpUserSubscriber instanceof SubscriberEntity);
|
||||
$subscriberNoList = $this->createSubscriberEntity(); // Subscriber without segment
|
||||
$this->entityManager->flush();
|
||||
|
||||
$count = $this->repository->getSubscribersCount((int)$segment->getId());
|
||||
expect($count)->equals(1);
|
||||
$count = $this->repository->getSubscribersCount((int)$segment->getId(), SubscriberEntity::STATUS_UNSUBSCRIBED);
|
||||
expect($count)->equals(0);
|
||||
$count = $this->repository->getSubscribersCount((int)$segment->getId(), SubscriberEntity::STATUS_SUBSCRIBED);
|
||||
expect($count)->equals(1);
|
||||
$ids = $this->repository->getSubscriberIdsInSegment((int)$segment->getId());
|
||||
expect($ids)->equals([$wpUserSubscriber->getId()]);
|
||||
$filteredIds = $this->repository->findSubscribersIdsInSegment((int)$segment->getId(), [$wpUserSubscriber->getId(), 20, 30]);
|
||||
|
Reference in New Issue
Block a user