Refactor sending task variable name and add typehint
[MAILPOET-1154]
This commit is contained in:
@ -153,7 +153,7 @@ class SendingQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendNewsletters(
|
function sendNewsletters(
|
||||||
$queue, $prepared_subscribers_ids, $prepared_newsletters,
|
SendingTask $sending_task, $prepared_subscribers_ids, $prepared_newsletters,
|
||||||
$prepared_subscribers, $statistics, $extra_params = array()
|
$prepared_subscribers, $statistics, $extra_params = array()
|
||||||
) {
|
) {
|
||||||
// send newsletter
|
// send newsletter
|
||||||
@ -171,10 +171,10 @@ class SendingQueue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// update processed/to process list
|
// update processed/to process list
|
||||||
if(!$queue->updateProcessedSubscribers($prepared_subscribers_ids)) {
|
if(!$sending_task->updateProcessedSubscribers($prepared_subscribers_ids)) {
|
||||||
MailerLog::processError(
|
MailerLog::processError(
|
||||||
'processed_list_update',
|
'processed_list_update',
|
||||||
sprintf('QUEUE-%d-PROCESSED-LIST-UPDATE', $queue->id),
|
sprintf('QUEUE-%d-PROCESSED-LIST-UPDATE', $sending_task->id),
|
||||||
null,
|
null,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -184,10 +184,10 @@ class SendingQueue {
|
|||||||
// update the sent count
|
// update the sent count
|
||||||
$this->mailer_task->updateSentCount();
|
$this->mailer_task->updateSentCount();
|
||||||
// enforce execution limits if queue is still being processed
|
// enforce execution limits if queue is still being processed
|
||||||
if($queue->status !== ScheduledTaskModel::STATUS_COMPLETED) {
|
if($sending_task->status !== ScheduledTaskModel::STATUS_COMPLETED) {
|
||||||
$this->enforceSendingAndExecutionLimits();
|
$this->enforceSendingAndExecutionLimits();
|
||||||
}
|
}
|
||||||
return $queue;
|
return $sending_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
function enforceSendingAndExecutionLimits() {
|
function enforceSendingAndExecutionLimits() {
|
||||||
|
@ -573,10 +573,10 @@ class SendingQueueTest extends \MailPoetTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testItPausesSendingWhenProcessedSubscriberListCannotBeUpdated() {
|
function testItPausesSendingWhenProcessedSubscriberListCannotBeUpdated() {
|
||||||
$queue = Mock::double(new \stdClass(), array(
|
$sending_task = Mock::double(SendingTask::create(), array(
|
||||||
'updateProcessedSubscribers' => false
|
'updateProcessedSubscribers' => false
|
||||||
));
|
));
|
||||||
$queue->id = 100;
|
$sending_task->id = 100;
|
||||||
$sending_queue_worker = Stub::make(new SendingQueueWorker());
|
$sending_queue_worker = Stub::make(new SendingQueueWorker());
|
||||||
$sending_queue_worker->__construct(
|
$sending_queue_worker->__construct(
|
||||||
$timer = false,
|
$timer = false,
|
||||||
@ -589,7 +589,7 @@ class SendingQueueTest extends \MailPoetTest {
|
|||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
$sending_queue_worker->sendNewsletters(
|
$sending_queue_worker->sendNewsletters(
|
||||||
$queue,
|
$sending_task->getObject(),
|
||||||
$prepared_subscribers = array(),
|
$prepared_subscribers = array(),
|
||||||
$prepared_newsletters = false,
|
$prepared_newsletters = false,
|
||||||
$prepared_subscribers = false,
|
$prepared_subscribers = false,
|
||||||
|
Reference in New Issue
Block a user