Activate automation for integration tests
[MAILPOET-4207]
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use MailPoet\Automation\Engine\Engine;
|
||||||
|
use MailPoet\Automation\Engine\Hooks;
|
||||||
|
use MailPoet\Automation\Engine\Migrations\Migrator;
|
||||||
|
use MailPoet\Automation\Integrations\MailPoet\MailPoetIntegration;
|
||||||
use MailPoet\Cache\TransientCache;
|
use MailPoet\Cache\TransientCache;
|
||||||
use MailPoet\DI\ContainerWrapper;
|
use MailPoet\DI\ContainerWrapper;
|
||||||
use MailPoet\Entities\ScheduledTaskEntity;
|
use MailPoet\Entities\ScheduledTaskEntity;
|
||||||
|
use MailPoet\Features\FeatureFlagsController;
|
||||||
use MailPoet\Features\FeaturesController;
|
use MailPoet\Features\FeaturesController;
|
||||||
use MailPoet\Settings\SettingsController;
|
use MailPoet\Settings\SettingsController;
|
||||||
use MailPoetVendor\Doctrine\DBAL\Connection;
|
use MailPoetVendor\Doctrine\DBAL\Connection;
|
||||||
@@ -85,6 +90,21 @@ if (is_dir((string)getenv('WP_TEST_CACHE_PATH'))) {
|
|||||||
// the action is called in ConflictResolverTest
|
// the action is called in ConflictResolverTest
|
||||||
remove_filter('admin_print_styles', 'wp_resource_hints', 1);
|
remove_filter('admin_print_styles', 'wp_resource_hints', 1);
|
||||||
|
|
||||||
|
// enable & initialize automation (this is needed only when behind a feature flag)
|
||||||
|
$_SERVER['SERVER_NAME'] = '';
|
||||||
|
$container = ContainerWrapper::getInstance();
|
||||||
|
$migrator = $container->get(Migrator::class);
|
||||||
|
$container->get(FeatureFlagsController::class)->set(FeaturesController::AUTOMATION, true);
|
||||||
|
if ($migrator->hasSchema()) {
|
||||||
|
$migrator->deleteSchema();
|
||||||
|
}
|
||||||
|
$migrator->createSchema();
|
||||||
|
$action = [$container->get(MailPoetIntegration::class), 'register'];
|
||||||
|
if (!has_action(Hooks::INITIALIZE, $action) && is_callable($action)) {
|
||||||
|
add_action(Hooks::INITIALIZE, $action);
|
||||||
|
$container->get(Engine::class)->initialize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property IntegrationTester $tester
|
* @property IntegrationTester $tester
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user