Tests: Place `remove_filter()` calls for `_wp_update_comment_data_filter()` before the assertions, for consistency with other tests.

Follow-up to [48154], [48222].

See #39732.

git-svn-id: https://develop.svn.wordpress.org/trunk@48231 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-06-30 12:27:05 +00:00
parent 595a799da0
commit cc4767cec0
2 changed files with 6 additions and 3 deletions

View File

@ -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 );
}
/**

View File

@ -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 );
}
/**