From 434dd6be91c7cc4e00520eb72026e12c7c109935 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Wed, 12 Jul 2023 20:04:02 +0000 Subject: [PATCH] Tests: Use assertSame() in Tests_Comment See #57855. git-svn-id: https://develop.svn.wordpress.org/trunk@56221 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/comment.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index 7858097f73..98fbbbbc41 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -60,7 +60,8 @@ class Tests_Comment extends WP_UnitTestCase { $this->assertSame( 1, $result ); $comment = get_comment( $comments[0] ); - $this->assertEquals( $comments[1], $comment->comment_parent ); + // The factory returns ints, but get_comment returns strings + $this->assertSame( (string) $comments[1], $comment->comment_parent ); $result = wp_update_comment( array( @@ -78,7 +79,8 @@ class Tests_Comment extends WP_UnitTestCase { ); $comment = get_comment( $comments[0] ); - $this->assertEquals( $post2->ID, $comment->comment_post_ID ); + // The factory returns ints, but get_comment returns strings + $this->assertSame( (string) $post2->ID, $comment->comment_post_ID ); } public function test_update_comment_from_privileged_user_by_privileged_user() { @@ -221,7 +223,7 @@ class Tests_Comment extends WP_UnitTestCase { ); $comment = get_comment( $comment_id ); - $this->assertEquals( 1, $comment->user_id ); + $this->assertSame( "1", $comment->user_id ); } /**