diff --git a/mailpoet/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php b/mailpoet/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php index dd019ccda4..a2b3dba23b 100644 --- a/mailpoet/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php +++ b/mailpoet/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php @@ -78,6 +78,8 @@ class AbandonedCartContentTest extends \MailPoetTest { $this->wp->wpDeletePost((int)$product->ID); } + register_post_type("product", ['public' => true]); + $this->productIds = []; $this->productIds[] = $this->createPost('Product 1', '2020-05-01 01:01:01', 'product'); $this->productIds[] = $this->createPost('Product 2', '2020-06-01 01:01:01', 'product'); diff --git a/mailpoet/tests/integration/_bootstrap.php b/mailpoet/tests/integration/_bootstrap.php index 43ac91b909..cfbdebb29e 100644 --- a/mailpoet/tests/integration/_bootstrap.php +++ b/mailpoet/tests/integration/_bootstrap.php @@ -137,6 +137,7 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore $this->entityManager->clear(); $this->restoreGlobals(); wp_set_current_user(0); + $this->cleanUpCustomEntities(); parent::tearDown(); } @@ -202,6 +203,12 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore } } } + + protected function cleanUpCustomEntities() { + if (post_type_exists('product')) { + unregister_post_type('product'); + } + } } function asCallable($fn) {