Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only a minor wording nit remains; no blocking issues were identified.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This pull request tightens comment-related PHPUnit assertions by using strict comparisons and matching expected value types.
Changes:
- Replaces loose assertions with
assertSame(). - Casts numeric database IDs to strings where required.
- Retains value-based comparison for distinct object instances.
| File | Description |
|---|---|
tests/phpunit/tests/comment/query.php |
Tightens comment query assertions and expected ID types; one minor wording nit noted. |
tests/phpunit/tests/comment/pingback.php |
Tightens pingback result assertions. |
tests/phpunit/tests/comment/commentsTemplate.php |
Tightens the offset assertion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| $this->assertNotEmpty( $query2->comments ); | ||
|
|
||
| /* | ||
| * Keep assertEquals() because the different objects instances |
|
Changes look good. I fixed a minor wording issue raised by Copilot in b2dbaf1 |
Compare comment query IDs as strings and use strict assertions for pagination offsets and pingback results. Explain why comment object arrays retain value-based comparison. Developed in: #13601 Props r1k0, mukesh27. See #64895. git-svn-id: https://develop.svn.wordpress.org/trunk@63774 602fd350-edb4-49c9-b593-d223f7449a82
Compare comment query IDs as strings and use strict assertions for pagination offsets and pingback results. Explain why comment object arrays retain value-based comparison. Developed in: WordPress/wordpress-develop#13601 Props r1k0, mukesh27. See #64895. Built from https://develop.svn.wordpress.org/trunk@63774 git-svn-id: http://core.svn.wordpress.org/trunk@62946 1a063a9b-81f0-0310-95a4-ce76da25c4cd

In
comment/commentsTemplate.phpChanged
assertEqualstoassertSamebecause the expected and actual values produce identical arrays.In
comment/pingback.phpTests_Comment_Pingback::test_pingback- ChangedassertEqualstoassertSamebecause the expected and actual values produce identical arrays.Tests_Comment_Pingback::test_pingback_no_ping_back & Tests_Comment_Pingback::test_pingback_error_response- ChangedassertEqualstoassertSamebecause the expected and actual values produce empty arrays.In
comment/query.phpTest_Comment_Query::test_get_comments_for_post- ChangedassertEqualstoassertSameand cast the expected value ($post_id) from an integer to a string because theWP_Comment::comment_post_IDis a numeric string.Test_Comment_Query::test_orderby_meta- ChangedassertEqualstoassertSameand cast the expected value ($comment_id) from an integer to a string because theWP_Comment::comment_IDis a numeric string.Test_Comment_Query::test_get_comments_by_user- ChangedassertEqualstoassertSameand cast the expected value ($users) from an integer to a string because theWP_Comment::user_idis a numeric string.Test_Comment_Query::test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASCandTest_Comment_Query::test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC- ChangedassertEqualstoassertSameand cast the expected array value ($comments) from an integer to a string because theWP_Comment::comment_IDis a numeric string.Test_Comment_Query::test_comment_query_object- KeptassertEqualsbecause the expected and actual output give different object instances but the same values.Trac ticket: #64895
Use of AI Tools
N/A
Note
This is a redo of #13593 because of mishaps on my end.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.