Test that inactive subscribers don't recieve newsletters

[MAILPOET-1970]
This commit is contained in:
Ján Mikláš
2019-04-11 09:10:06 +02:00
committed by M. Shull
parent b9819c3691
commit 814fc7c078

View File

@ -604,6 +604,24 @@ class SendingQueueTest extends \MailPoetTest {
expect((int)$updated_queue->count_total)->equals(0);
}
function testItDoesNotSendToInactiveSubscribers() {
$sending_queue_worker = $this->sending_queue_worker;
$sending_queue_worker->mailer_task = Stub::make(
new MailerTask(),
array('send' => true)
);
// newsletter is not sent to inactive subscriber
$this->_after();
$this->_before();
$subscriber = $this->subscriber;
$subscriber->status = Subscriber::STATUS_INACTIVE;
$subscriber->save();
$sending_queue_worker->process();
$updated_queue = SendingTask::createFromQueue(SendingQueue::findOne($this->queue->id));
expect((int)$updated_queue->count_total)->equals(0);
}
function testItPausesSendingWhenProcessedSubscriberListCannotBeUpdated() {
$sending_task = Mock::double(SendingTask::create(), array(
'updateProcessedSubscribers' => false