diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index 8acbe29e2b..5d4fa6e4f0 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -149,6 +149,7 @@ class Tests_Comment extends WP_UnitTestCase { $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); add_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); + $result = wp_update_comment( array( 'comment_ID' => $comment_id, @@ -156,8 +157,10 @@ class Tests_Comment extends WP_UnitTestCase { ), true ); - $this->assertWPError( $result ); + remove_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); + + $this->assertWPError( $result ); } /** diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 5bf7cd10dc..84b2d51dd3 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -2808,9 +2808,9 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase $request->set_body( wp_json_encode( $params ) ); $response = rest_get_server()->dispatch( $request ); - $this->assertErrorResponse( 'rest_comment_failed_edit', $response, 500 ); - remove_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); + + $this->assertErrorResponse( 'rest_comment_failed_edit', $response, 500 ); } /**