Make WordPress Core

Changeset 49849


Ignore:
Timestamp:
12/21/2020 03:33:48 AM (4 years ago)
Author:
peterwilsoncc
Message:

Tests: Revert use of shared post fixture in comment template tests.

Removes code throwing a fatal in PHP 8.

Reverts [49848] from trunk.
See #51802.

File:
1 edited

Legend:

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

    r49848 r49849  
    44 */
    55class Tests_Comment_Template extends WP_UnitTestCase {
    6     /**
    7      * Shared post ID.
    8      *
    9      * @var int
    10      */
    11     public static $post_id;
    12 
    13     /**
    14      * Set up shared fixtures.
    15      *
    16      * @param WP_UnitTest_Factory $factory Unit test factory.
    17      */
    18     function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    19         self::$post_id = self::factory()->post->create();
    20     }
    216
    227    function test_get_comments_number() {
    23         $post_id = self::$post_id;
     8        $post_id = self::factory()->post->create();
    249
    2510        $this->assertSame( 0, get_comments_number( 0 ) );
     
    3419
    3520    function test_get_comments_number_without_arg() {
    36         $post_id   = self::$post_id;
     21        $post_id   = self::factory()->post->create();
    3722        $permalink = get_permalink( $post_id );
    3823        $this->go_to( $permalink );
     
    5035     */
    5136    function test_get_comments_number_text_with_post_id() {
    52         $post_id = self::$post_id;
     37        $post_id = $this->factory->post->create();
    5338        $this->factory->comment->create_post_comments( $post_id, 6 );
    5439
     
    6954     */
    7055    function test_get_comments_number_text_declension_with_default_args() {
    71         $post_id   = self::$post_id;
     56        $post_id   = $this->factory->post->create();
    7257        $permalink = get_permalink( $post_id );
    7358        $this->go_to( $permalink );
     
    9277     */
    9378    function test_get_comments_number_text_declension_with_custom_args( $number, $input, $output ) {
    94         $post_id   = self::$post_id;
     79        $post_id   = $this->factory->post->create();
    9580        $permalink = get_permalink( $post_id );
    9681
Note: See TracChangeset for help on using the changeset viewer.