Tests: Reset the current user before performing assertions in some comment tests.

This aims to avoid affecting other tests in case of failure.

Follow-up to [54527].

See #58955.

git-svn-id: https://develop.svn.wordpress.org/trunk@56936 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-10-15 08:07:11 +00:00
parent 12dc9ca50b
commit 0633814df8

View File

@ -121,14 +121,14 @@ class Tests_Comment extends WP_UnitTestCase {
)
);
wp_set_current_user( 0 );
$comment = get_comment( $comment_id );
$expected_content = is_multisite()
? 'new comment '
: 'new comment <img onerror=demo src=x>';
$this->assertSame( $expected_content, $comment->comment_content );
wp_set_current_user( 0 );
}
public function test_update_comment_from_unprivileged_user_by_privileged_user() {
@ -165,9 +165,10 @@ class Tests_Comment extends WP_UnitTestCase {
)
);
wp_set_current_user( 0 );
$comment = get_comment( $comment_id );
$this->assertSame( '<a href="http://example.localhost/something.html" rel="nofollow ugc">click</a>', $comment->comment_content, 'Comment: ' . $comment->comment_content );
wp_set_current_user( 0 );
}
/**