Repository navigation
Tests: Add unit coverage for comment_excerpt() - #15281
shail-mehta wants to merge 3 commits into
Conversation
Add unit tests for excerpt display output, comment objects, global fallback, and the display filter. See #65819.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for this test-only addition of PHPUnit coverage for comment excerpt behavior.
No open issues 🎉
What changed in this PR
Adds dedicated PHPUnit coverage for comment_excerpt() as part of the #65819 test cleanup effort. This is a test-only change with no production code changes.
Changes:
- Tests echoed output with a comment ID or comment object.
- Covers the global comment fallback and display-filter customization.
- Adds explicit coverage annotations for
comment_excerpt()andget_comment_excerpt().
| File | Description |
|---|---|
tests/phpunit/tests/comment/commentExcerpt.php |
Adds four tests covering excerpt output, accepted inputs, global fallback, and filtering. |
Review effort: Balanced
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
Please use the literal fixture text, Short comment excerpt text., as the expected output in the three unfiltered display tests. Calling get_comment_excerpt() to compute the expected result lets a regression in that same getter change both sides of the assertion. The fixture already tells us the intended output.
The tests pass locally in randomized single-site and multisite runs; this small change makes their oracle independent before landing.
AI review · gpt-6
Avoid deriving expectations from get_comment_excerpt() so the display assertions stay independent of that getter. See #65819.
|
Thanks for the review! Addressed in 61e97c0 |
Trac ticket: #65819
What
Adds a dedicated PHPUnit class for
comment_excerpt(), covering display output, comment objects, the global comment fallback, and the display filter.Test-only; no production code changes.
Why
comment_excerpt()had no direct@coverscoverage. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/comment/commentExcerpt.phpwith@covers ::comment_excerptand@covers ::get_comment_excerpt.Testing Instructions
npm run test:php -- --filter Tests_Comment_CommentExcerptnpm run test:php -- --filter Tests_Comment_CommentExcerpt -c tests/phpunit/multisite.xmlnpm run test:php -- --filter Tests_Comment_CommentExcerpt --order-by=randomnpm run test:php -- --group commentUse of AI Tools