Fix Migration worker tests
[MAILPOET-2539]
This commit is contained in:
committed by
Jack Kitterhing
parent
adb4bb864e
commit
a8f1cd15bf
@ -57,8 +57,8 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
function testItPausesSendingWhenPreparingATask() {
|
function testItPausesSendingWhenPreparingATask() {
|
||||||
$task = $this->createScheduledTask();
|
$task = $this->createScheduledTask();
|
||||||
expect(MailerLog::isSendingPaused())->false();
|
expect(MailerLog::isSendingPaused())->false();
|
||||||
$this->worker->prepareTask($task, microtime(true));
|
$result = $this->worker->prepareTaskStrategy($task, microtime(true));
|
||||||
expect($task->status)->null();
|
expect($result)->true();
|
||||||
expect(MailerLog::isSendingPaused())->true();
|
expect(MailerLog::isSendingPaused())->true();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,14 +67,14 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
$this->worker->pauseSending();
|
$this->worker->pauseSending();
|
||||||
expect(MailerLog::isSendingPaused())->true();
|
expect(MailerLog::isSendingPaused())->true();
|
||||||
$task = $this->createScheduledTask();
|
$task = $this->createScheduledTask();
|
||||||
$this->worker->prepareTask($task, microtime(true));
|
$this->worker->prepareTaskStrategy($task, microtime(true));
|
||||||
expect(MailerLog::isSendingPaused())->false();
|
expect(MailerLog::isSendingPaused())->false();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCompletesTaskIfThereIsNothingToMigrate() {
|
function testItCompletesTaskIfThereIsNothingToMigrate() {
|
||||||
SendingQueue::deleteMany();
|
SendingQueue::deleteMany();
|
||||||
$task = $this->createScheduledTask();
|
$task = $this->createScheduledTask();
|
||||||
$this->worker->prepareTask($task, microtime(true));
|
$this->worker->prepareTaskStrategy($task, microtime(true));
|
||||||
expect(ScheduledTask::findOne($task->id)->status)->equals(ScheduledTask::STATUS_COMPLETED);
|
expect(ScheduledTask::findOne($task->id)->status)->equals(ScheduledTask::STATUS_COMPLETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(0);
|
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(0);
|
||||||
|
|
||||||
$task = $this->createRunningTask();
|
$task = $this->createRunningTask();
|
||||||
$this->worker->processTask($task, microtime(true));
|
$this->worker->processTaskStrategy($task, microtime(true));
|
||||||
|
|
||||||
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
|
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
|
||||||
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
|
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
|
||||||
@ -106,7 +106,7 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
$this->worker->pauseSending();
|
$this->worker->pauseSending();
|
||||||
expect(MailerLog::isSendingPaused())->true();
|
expect(MailerLog::isSendingPaused())->true();
|
||||||
$task = $this->createRunningTask();
|
$task = $this->createRunningTask();
|
||||||
$this->worker->processTask($task, microtime(true));
|
$this->worker->processTaskStrategy($task, microtime(true));
|
||||||
expect(MailerLog::isSendingPaused())->false();
|
expect(MailerLog::isSendingPaused())->false();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user