Switch template registration to use register_block_template
[MAILPOET-6356]
This commit is contained in:
committed by
Rostislav Wolný
parent
62b77b724c
commit
2fc0ad3c9e
@@ -73,6 +73,7 @@ class IntegrationTester extends \Codeception\Actor {
|
||||
*/
|
||||
public function cleanup(): void {
|
||||
$this->delete_posts();
|
||||
$this->unregister_block_templates();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,4 +95,17 @@ class IntegrationTester extends \Codeception\Actor {
|
||||
}
|
||||
$this->cleanup_user_theme_post();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister block templates we may add during the tests.
|
||||
*/
|
||||
private function unregister_block_templates(): void {
|
||||
$registry = WP_Block_Templates_Registry::get_instance();
|
||||
$templates = $registry->get_all_registered();
|
||||
foreach ( $templates as $name => $template ) {
|
||||
if ( 'mailpoet' === $template->plugin && $registry->is_registered( $name ) ) {
|
||||
$registry->unregister( $name );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user