Revert "Revert "Fix failing tests because of un-registered product post type""
This reverts commit fbcfa6db82
.
This commit is contained in:
@@ -78,6 +78,8 @@ class AbandonedCartContentTest extends \MailPoetTest {
|
|||||||
$this->wp->wpDeletePost((int)$product->ID);
|
$this->wp->wpDeletePost((int)$product->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
register_post_type("product", ['public' => true]);
|
||||||
|
|
||||||
$this->productIds = [];
|
$this->productIds = [];
|
||||||
$this->productIds[] = $this->createPost('Product 1', '2020-05-01 01:01:01', 'product');
|
$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');
|
$this->productIds[] = $this->createPost('Product 2', '2020-06-01 01:01:01', 'product');
|
||||||
|
@@ -137,6 +137,7 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore
|
|||||||
$this->entityManager->clear();
|
$this->entityManager->clear();
|
||||||
$this->restoreGlobals();
|
$this->restoreGlobals();
|
||||||
wp_set_current_user(0);
|
wp_set_current_user(0);
|
||||||
|
$this->cleanUpCustomEntities();
|
||||||
parent::tearDown();
|
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) {
|
function asCallable($fn) {
|
||||||
|
Reference in New Issue
Block a user