Repository navigation
Tests: Assert comment list output in Recent Comments widget XHTML navigation test - #14338
shail-mehta wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The assertion matches the existing fixtures and test pattern, with no unresolved issues.
0 open findings
What changed in this PR
Strengthens the Recent Comments widget’s XHTML navigation test without changing production code.
Changes:
- Adds an assertion that five comments remain rendered, preventing empty output from passing the existing negative navigation check.
| File | Description |
|---|---|
| tests/phpunit/tests/widgets/wpWidgetRecentComments.php | Asserts the rendered comment count in the XHTML navigation test. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
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. |
Assert that the Recent Comments widget still renders five comments in XHTML mode, alongside the existing check that it omits the navigation wrapper. This prevents empty output from satisfying the negative assertion. Developed in: #14338 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64418 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14338 landed in https://core.trac.wordpress.org/changeset/64418 |
Assert that the Recent Comments widget still renders five comments in XHTML mode, alongside the existing check that it omits the navigation wrapper. This prevents empty output from satisfying the negative assertion. Developed in: WordPress/wordpress-develop#14338 Props shailu25. See #65819. Built from https://develop.svn.wordpress.org/trunk@64418 git-svn-id: http://core.svn.wordpress.org/trunk@63568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What
Trac Ticket: #65819
Adds an assertion in
Tests_Widgets_wpWidgetRecentComments::test_widget_omits_navigation_wrapper_in_xhtml()verifying that the 5 recent comments are still rendered in the widget output when the navigation format isxhtml.Follow-up to r64357 / #14273 feedback in comment:175.
Why
Previously,
test_widget_omits_navigation_wrapper_in_xhtml()only checked$this->assertFalse( $processor->next_tag( 'NAV' ) ). Because that is a negative assertion, an empty string or broken widget output would also satisfy the check and pass the test without rendering the comment list.How
Calls
$this->assertCount( 5, $this->get_listed_authors( $output ), 'The comments should still be listed.' )after the<nav>tag check, matching the existing pattern used intest_widget_omits_title_markup_for_empty_filtered_title()in the same test class.This is a test-only change; no production code is modified.
Testing Instructions
npm run test:php -- --filter Tests_Widgets_wpWidgetRecentCommentsnpm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Widgets_wpWidgetRecentCommentsnpm run test:php -- --filter Tests_Widgets_wpWidgetRecentComments --order-by=random./vendor/bin/phpcs tests/phpunit/tests/widgets/wpWidgetRecentComments.phpUse of AI Tools