Fix Migration worker tests

[MAILPOET-2539]
This commit is contained in:
Jan Jakeš
2019-12-16 15:10:12 +01:00
committed by Jack Kitterhing
parent adb4bb864e
commit a8f1cd15bf

View File

@ -57,8 +57,8 @@ class MigrationTest extends \MailPoetTest {
function testItPausesSendingWhenPreparingATask() {
$task = $this->createScheduledTask();
expect(MailerLog::isSendingPaused())->false();
$this->worker->prepareTask($task, microtime(true));
expect($task->status)->null();
$result = $this->worker->prepareTaskStrategy($task, microtime(true));
expect($result)->true();
expect(MailerLog::isSendingPaused())->true();
}
@ -67,14 +67,14 @@ class MigrationTest extends \MailPoetTest {
$this->worker->pauseSending();
expect(MailerLog::isSendingPaused())->true();
$task = $this->createScheduledTask();
$this->worker->prepareTask($task, microtime(true));
$this->worker->prepareTaskStrategy($task, microtime(true));
expect(MailerLog::isSendingPaused())->false();
}
function testItCompletesTaskIfThereIsNothingToMigrate() {
SendingQueue::deleteMany();
$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);
}
@ -84,7 +84,7 @@ class MigrationTest extends \MailPoetTest {
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(0);
$task = $this->createRunningTask();
$this->worker->processTask($task, microtime(true));
$this->worker->processTaskStrategy($task, microtime(true));
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
@ -106,7 +106,7 @@ class MigrationTest extends \MailPoetTest {
$this->worker->pauseSending();
expect(MailerLog::isSendingPaused())->true();
$task = $this->createRunningTask();
$this->worker->processTask($task, microtime(true));
$this->worker->processTaskStrategy($task, microtime(true));
expect(MailerLog::isSendingPaused())->false();
}