Skip to content

Commit

Permalink
Coding Standards: Use single quotes for a string in Tests_Comment.
Browse files Browse the repository at this point in the history
This resolves a WPCS error:
{{{
Error: String "1" does not require double quotes; use single quotes instead.
}}}

Includes updating a few related comments for clarity.

Follow-up to [56221].

See #57855.

git-svn-id: https://develop.svn.wordpress.org/trunk@56222 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jul 12, 2023
1 parent 434dd6b commit cdf3ac0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/phpunit/tests/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public function test_wp_update_comment() {
$this->assertSame( 1, $result );

$comment = get_comment( $comments[0] );
// The factory returns ints, but get_comment returns strings
/*
* ::create_post_comments() returns comment IDs as integers,
* but WP_Comment::$comment_parent is a string.
*/
$this->assertSame( (string) $comments[1], $comment->comment_parent );

$result = wp_update_comment(
Expand All @@ -79,7 +82,7 @@ public function test_wp_update_comment() {
);

$comment = get_comment( $comments[0] );
// The factory returns ints, but get_comment returns strings
// WP_Post::$ID is an integer, but WP_Comment::$comment_post_ID is a string.
$this->assertSame( (string) $post2->ID, $comment->comment_post_ID );
}

Expand Down Expand Up @@ -223,7 +226,7 @@ public function test_wp_update_comment_updates_user_id() {
);

$comment = get_comment( $comment_id );
$this->assertSame( "1", $comment->user_id );
$this->assertSame( '1', $comment->user_id );
}

/**
Expand Down

0 comments on commit cdf3ac0

Please sign in to comment.