WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/07/2021 10:51:59 AM (4 months ago)
Author:
SergeyBiryukov
Message:

Tests: Fix tests failing due to assertContains() using strict checking.

Since PHPUnit 8.0.2, the assertContains() method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:

Follow-up to [51559-51570].

Props jrf.
See #46149.

File:
1 edited

Legend:

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

    r50559 r51571  
    486486        remove_filter( 'wp_get_current_commenter', array( $this, 'get_current_commenter' ) );
    487487
    488         $this->assertContains( $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
     488        $this->assertContains( (string) $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
    489489    }
    490490
     
    543543        );
    544544
    545         $this->assertContains( $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
     545        $this->assertContains( (string) $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
    546546
    547547        wp_set_current_user( $current_user );
Note: See TracChangeset for help on using the changeset viewer.