Use processTaskStrategy() instead of custom logic in Migration worker

[MAILPOET-2538]
This commit is contained in:
Jan Jakeš
2019-11-18 16:43:53 +01:00
committed by Jack Kitterhing
parent 8a8b34e554
commit ac794aaca2
3 changed files with 17 additions and 15 deletions

View File

@ -15,6 +15,9 @@ use MailPoet\Tasks\Sending as SendingTask;
use MailPoet\WP\Functions as WPFunctions;
class MigrationTest extends \MailPoetTest {
/** @var Migration */
private $worker;
function _before() {
parent::_before();
// Alter table to test migration
@ -63,17 +66,15 @@ class MigrationTest extends \MailPoetTest {
$this->worker->pauseSending();
expect(MailerLog::isSendingPaused())->true();
$task = $this->createScheduledTask();
$result = $this->worker->prepareTask($task);
expect($result)->false();
$this->worker->prepareTask($task);
expect(MailerLog::isSendingPaused())->false();
}
function testItCompletesTaskIfThereIsNothingToMigrate() {
SendingQueue::deleteMany();
$task = $this->createScheduledTask();
$result = $this->worker->prepareTask($task);
$this->worker->prepareTask($task);
expect(ScheduledTask::findOne($task->id)->status)->equals(ScheduledTask::STATUS_COMPLETED);
expect($result)->false();
}
function testItMigratesSendingQueuesAndSubscribers() {