mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* https://github.com/sebastianbergmann/phpunit/issues/3511
* 6205f33595
Follow-up to [51559-51570].
Props jrf.
See #46149.
git-svn-id: https://develop.svn.wordpress.org/trunk@51571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fcd4aa4700
commit
60dcae95ea
@ -485,7 +485,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase {
|
||||
|
||||
remove_filter( 'wp_get_current_commenter', array( $this, 'get_current_commenter' ) );
|
||||
|
||||
$this->assertContains( $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
|
||||
$this->assertContains( (string) $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
|
||||
}
|
||||
|
||||
public function get_current_commenter() {
|
||||
@ -542,7 +542,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertContains( $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
|
||||
$this->assertContains( (string) $new_unapproved, wp_list_pluck( $comments, 'comment_ID' ) );
|
||||
|
||||
wp_set_current_user( $current_user );
|
||||
}
|
||||
|
||||
@ -891,8 +891,8 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
|
||||
$meta = get_post_meta( self::$post_id, 'test_custom_schema_multi', false );
|
||||
$this->assertNotEmpty( $meta );
|
||||
$this->assertCount( 2, $meta );
|
||||
$this->assertContains( 2, $meta );
|
||||
$this->assertContains( 8, $meta );
|
||||
$this->assertContains( '2', $meta );
|
||||
$this->assertContains( '8', $meta );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -838,8 +838,8 @@ class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase {
|
||||
$meta = get_term_meta( self::$category_id, 'test_custom_schema_multi', false );
|
||||
$this->assertNotEmpty( $meta );
|
||||
$this->assertCount( 2, $meta );
|
||||
$this->assertContains( 2, $meta );
|
||||
$this->assertContains( 8, $meta );
|
||||
$this->assertContains( '2', $meta );
|
||||
$this->assertContains( '8', $meta );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user