Skip to content

Tests: Add unit coverage for comment_excerpt() - #15281

Draft
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/comment-excerpt-65819
Draft

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/comment-excerpt-65819

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

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 @covers coverage. Small helper coverage fits the #65819 test cleanup track.

How

Add tests/phpunit/tests/comment/commentExcerpt.php with @covers ::comment_excerpt and @covers ::get_comment_excerpt.

Testing Instructions

  1. npm run test:php -- --filter Tests_Comment_CommentExcerpt
  2. npm run test:php -- --filter Tests_Comment_CommentExcerpt -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Comment_CommentExcerpt --order-by=random
  4. npm run test:php -- --group comment

Use of AI Tools

  • Cursor

Add unit tests for excerpt display output, comment objects, global fallback, and the display filter.

See #65819.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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() and get_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants