Make WordPress Core

Changeset 56936


Ignore:
Timestamp:
10/15/2023 08:07:11 AM (6 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment.php

    r56548 r56936  
    122122        );
    123123
     124        wp_set_current_user( 0 );
     125
    124126        $comment          = get_comment( $comment_id );
    125127        $expected_content = is_multisite()
     
    128130
    129131        $this->assertSame( $expected_content, $comment->comment_content );
    130 
    131         wp_set_current_user( 0 );
    132132    }
    133133
     
    166166        );
    167167
     168        wp_set_current_user( 0 );
     169
    168170        $comment = get_comment( $comment_id );
    169171        $this->assertSame( '<a href="http://example.localhost/something.html" rel="nofollow ugc">click</a>', $comment->comment_content, 'Comment: ' . $comment->comment_content );
    170         wp_set_current_user( 0 );
    171172    }
    172173
Note: See TracChangeset for help on using the changeset viewer.