Consider also confirmed_at for subscribers deactivation

[MAILPOET-1791]
This commit is contained in:
Rostislav Wolny
2019-04-19 13:27:32 +02:00
committed by M. Shull
parent 8e46f12a0e
commit a8584523d3
2 changed files with 18 additions and 4 deletions

View File

@ -76,7 +76,7 @@ class InactiveSubscribersControllerTest extends \MailPoetTest {
}
function testItDoesNotDeactivateNewSubscriberWithUnopenedEmail() {
list($task) = $this->createCompletedSendingTaskWithOneOpen(1);
list($task) = $this->createCompletedSendingTaskWithOneOpen(3);
$subscriber = $this->createSubscriber('s1@email.com', 2);
$this->addSubcriberToTask($subscriber, $task);
@ -87,8 +87,22 @@ class InactiveSubscribersControllerTest extends \MailPoetTest {
expect($subscriber->status)->equals(Subscriber::STATUS_SUBSCRIBED);
}
function testItDoesNotDeactivateNewlyConfirmedSubscriberWithUnopenedEmail() {
list($task) = $this->createCompletedSendingTaskWithOneOpen(3);
$subscriber = $this->createSubscriber('s1@email.com', 10);
$subscriber->confirmed_at = (new Carbon())->subDays(2)->toDateTimeString();
$subscriber->save();
$this->addSubcriberToTask($subscriber, $task);
$result = $this->controller->markInactiveSubscribers(5, 100);
expect($result)->equals(0);
$subscriber = Subscriber::findOne($subscriber->id);
expect($subscriber->status)->equals(Subscriber::STATUS_SUBSCRIBED);
}
function testItDoesNotDeactivateSubscriberWithoutSentEmail() {
$this->createCompletedSendingTaskWithOneOpen(1);
$this->createCompletedSendingTaskWithOneOpen(3);
$subscriber = $this->createSubscriber('s1@email.com', 10);
$result = $this->controller->markInactiveSubscribers(5, 100);
expect($result)->equals(0);