Add user theme post cleanup to integration tests

This commit adds automatic cleanup of the user theme post before every test
[MAILPOET-6335]
This commit is contained in:
Rostislav Wolny
2024-12-10 16:57:51 +01:00
committed by Aschepikov
parent 993cbb4fd7
commit 15818f37ef

View File

@@ -75,6 +75,16 @@ class IntegrationTester extends \Codeception\Actor {
$this->delete_posts();
}
/**
* Deletes user theme post that might be created during the test.
*/
public function cleanup_user_theme_post(): void {
$post = get_page_by_path( 'wp-global-styles-mailpoet-email', OBJECT, 'wp_global_styles' );
if ( $post ) {
wp_delete_post( $post->ID, true );
}
}
/**
* Delete created posts.
*/
@@ -82,5 +92,6 @@ class IntegrationTester extends \Codeception\Actor {
foreach ( $this->posts as $post ) {
wp_delete_post( $post->ID, true );
}
$this->cleanup_user_theme_post();
}
}