From c18c518fa4edaeaafa990d00cbb801d0fb90414f Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 15 Dec 2021 18:16:29 -0500 Subject: [PATCH] Jetpack: Fix a legacy-full-sync test with PHPUnit 9.5 (#22112) At some point PHPUnit changed `assertContains()` to do strict comparison. Now that we're running the coverage tests with PHP 8 and PHPUnit 9.5, a test was failing due to string vs int comparison. Co-authored-by: Brandon Kraft --- .../jetpack/changelog/fix-jetpack-legacy-full-sync-test-php-8 | 4 ++++ .../jetpack/tests/php/sync/test_class.jetpack-sync-full.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/jetpack/changelog/fix-jetpack-legacy-full-sync-test-php-8 diff --git a/projects/plugins/jetpack/changelog/fix-jetpack-legacy-full-sync-test-php-8 b/projects/plugins/jetpack/changelog/fix-jetpack-legacy-full-sync-test-php-8 new file mode 100644 index 0000000000000..637578e8e5608 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-jetpack-legacy-full-sync-test-php-8 @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Fix a legacy sync test in PHPUnit 9.5. diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php index 35750b6baa7ec..a15f3cf04c401 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php @@ -1267,7 +1267,7 @@ function test_full_sync_can_sync_individual_comments() { $comments = $synced_comments_event->args[0]; $this->assertEquals( 2, count( $comments ) ); - $comment_ids = array( $comments[0]->comment_ID, $comments[1]->comment_ID ); + $comment_ids = array( (int) $comments[0]->comment_ID, (int) $comments[1]->comment_ID ); $this->assertContains( $sync_comment_id, $comment_ids ); $this->assertContains( $sync_comment_id_2, $comment_ids );