Change coding style in email editor tests to WordPress

This commit contains automated changes made with phpcbf command from CodeSniffer package.

[MAILPOET-6240]
This commit is contained in:
Jan Lysý
2024-11-04 11:19:26 +01:00
committed by Jan Lysý
parent 8d7f26c42d
commit 113dbaae2d
29 changed files with 2625 additions and 2405 deletions

View File

@@ -3,6 +3,7 @@
/**
* Inherited Methods
*
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
@@ -15,37 +16,37 @@
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class IntegrationTester extends \Codeception\Actor
{
use _generated\IntegrationTesterActions;
*/
class IntegrationTester extends \Codeception\Actor {
private $wpTermIds = [];
use _generated\IntegrationTesterActions;
private $createdCommentIds = [];
private $wpTermIds = array();
private $posts = [];
private $createdCommentIds = array();
public function createPost(array $params): \WP_Post {
$postId = wp_insert_post($params);
if ($postId instanceof WP_Error) {
throw new \Exception('Failed to create post');
}
$post = get_post($postId);
if (!$post instanceof WP_Post) {
throw new \Exception('Failed to fetch the post');
}
$this->posts[] = $post;
return $post;
}
private $posts = array();
public function cleanup() {
$this->deletePosts();
}
public function createPost( array $params ): \WP_Post {
$postId = wp_insert_post( $params );
if ( $postId instanceof WP_Error ) {
throw new \Exception( 'Failed to create post' );
}
$post = get_post( $postId );
if ( ! $post instanceof WP_Post ) {
throw new \Exception( 'Failed to fetch the post' );
}
$this->posts[] = $post;
return $post;
}
private function deletePosts() {
foreach ($this->posts as $post) {
wp_delete_post($post->ID, true);
}
}
public function cleanup() {
$this->deletePosts();
}
private function deletePosts() {
foreach ( $this->posts as $post ) {
wp_delete_post( $post->ID, true );
}
}
}