Unschedule cron actions before running migrations

We don't want to run any actions during migrations.
This will also clean duplicate trigger actions
that were potentially created because of requests race conditions.
[MAILPOET-4684]
This commit is contained in:
Rostislav Wolny
2022-09-28 14:10:59 +02:00
committed by Aschepikov
parent 1711d60871
commit b96b549f43
2 changed files with 27 additions and 2 deletions

View File

@ -9,6 +9,7 @@ use MailPoet\API\JSON\v1\Setup;
use MailPoet\Config\Activator;
use MailPoet\Config\Migrator;
use MailPoet\Config\Populator;
use MailPoet\Cron\ActionScheduler\ActionScheduler;
use MailPoet\Form\FormsRepository;
use MailPoet\Referrals\ReferralDetector;
use MailPoet\Segments\WP;
@ -34,7 +35,8 @@ class SetupTest extends \MailPoetTest {
$subscriptionCaptcha = $this->diContainer->get(Captcha::class);
$populator = $this->getServiceWithOverrides(Populator::class, ['wp' => $wpStub, 'referralDetector' => $referralDetector]);
$migrator = $this->diContainer->get(Migrator::class);
$router = new Setup($wpStub, new Activator($settings, $populator, $wpStub, $migrator));
$cronActionScheduler = $this->diContainer->get(ActionScheduler::class);
$router = new Setup($wpStub, new Activator($settings, $populator, $wpStub, $migrator, $cronActionScheduler));
$response = $router->reset();
expect($response->status)->equals(APIResponse::STATUS_OK);