Repository navigation
Conversation
Cover the constructor settings and conditional style hook, the default styles, the listed comments and their markup, the number setting, title and comments filters, navigation markup, settings sanitization, form fields, and the deprecated cache flush method. See #65819.
|
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.
🟢 Approval recommended
The test-only changes match existing behavior and conventions, with no blocking issues identified.
0 open findings
What changed in this PR
Adds unit coverage for WP_Widget_Recent_Comments, following existing widget test patterns without changing production code.
Changes:
- Tests rendering, comment selection, filters, styles, and navigation markup.
- Covers settings sanitization, form defaults, and cache-method deprecation.
| File | Description |
|---|---|
| tests/phpunit/tests/widgets/wpWidgetRecentComments.php | Adds fixtures and tests for Recent Comments widget behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
lancewillett
left a comment
There was a problem hiding this comment.
No blockers found in the code review or scoped unit-tests audit. The focused randomized run passed with 38 tests and 60 assertions; the widgets group passed on single-site and multisite with 286 tests and 1,256 assertions each. PHPCS and CI passed.
AI review · gpt-6
|
Optional follow-up: in test_widget_omits_navigation_wrapper_in_xhtml(), also assert that the comment list remains present. That would prevent an empty response from satisfying the negative navigation assertion. This is not a landing blocker. AI review · |
|
PR #14273 landed in https://core.trac.wordpress.org/changeset/64357 |
Cover comment ordering and visibility, widget filters and markup, styles, settings sanitization, form fields, and the deprecated cache method. Developed in: #14273 Props ravipatel. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64357 602fd350-edb4-49c9-b593-d223f7449a82
Cover comment ordering and visibility, widget filters and markup, styles, settings sanitization, form fields, and the deprecated cache method. Developed in: WordPress/wordpress-develop#14273 Props ravipatel. See #65819. Built from https://develop.svn.wordpress.org/trunk@64357 git-svn-id: http://core.svn.wordpress.org/trunk@63507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds unit test coverage for
WP_Widget_Recent_Comments, which currently has none, following the same approach as the recentWP_Widget_Pages,WP_Widget_CategoriesandWP_Widget_Tag_Cloudtests.Trac ticket: https://core.trac.wordpress.org/ticket/65819
What's covered
__construct(): widget settings, and that thewp_headstyle callback is only hooked when the widget is in an active sidebar.recent_comments_style(): the default styles, no output without theme support for widgets, and theshow_recent_comments_widget_stylefilter.widget(): the five most recent comments, newest first; only approved comments on published posts; the markup of a listed comment; thenumbersetting; thewidget_comments_argsandwidget_titlefilters; the title fallback; an empty list; the list ID used after the first instance; the HTML5 navigation wrapper and itsaria-label.update(): sanitization and keeping other settings.form(): fields with saved and default values.flush_widget_cache(): the deprecation notice.Notes
<ul id="recentcomments">used by the first widget on a page is tracked in astaticvariable for the whole request, so only the IDs used after it are tested.remove_theme_support()doesn't remove the internalwidgetsregistration, so_remove_theme_support()is used. Theme features are restored intear_down().Testing
npm run test:php -- --filter Tests_Widgets_wpWidgetRecentComments: OK (38 tests, 60 assertions)npm run test:php -- --group widgetsand--group commentpass.absint()fromupdate(), makes the tests fail.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Writing the tests and this description. I reviewed the tests, ran them locally, and take responsibility for them.
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.