Repository navigation
Tests: Add unit test coverage for WP_Widget_Meta - #14181
huzaifaalmesbah wants to merge 1 commit into
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. |
|
Great work adding comprehensive test coverage for The suite nicely covers both logged-in and logged-out views, the A couple of minor observations:
Overall, the class structure is very clean and adheres well to Core conventions! |
Description
Adds a test class for
WP_Widget_Meta, which had no tests. The tests cover the registration settings, the title shown bywidget()(custom, default and falsy values), thewidget_titlefilter arguments and the omitted title wrapper when it returns an empty string, the<nav>wrapper and itsaria-labelfor thehtml5format and its absence forxhtml, the log in, feed and WordPress.org links for a logged-out visitor, the Site Admin and log out links for a logged-in user, thewidget_meta_poweredbyfilter arguments and return value, and thewp_metaaction. They also cover title sanitization inupdate(), thatupdate()keeps the other settings of the old instance, and the escaped title field rendered byform().This is a test-only change; no production code is modified.
Testing Instructions
npm run test:php -- --filter 'Tests_Widgets_wpWidgetMeta'npm run test:php -- --filter 'Tests_Widgets_wpWidgetMeta' -c tests/phpunit/multisite.xmlnpm run test:php -- --filter 'Tests_Widgets_wpWidgetMeta' --order-by=randomnpm run test:php -- --group widgetsnode ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpcs tests/phpunit/tests/widgets/wpWidgetMeta.phpTrac ticket: https://core.trac.wordpress.org/ticket/65819
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Brainstorming edge-case scenarios and drafting test boilerplate; test architecture, assertions, and local PHPUnit verification were written and validated by me.