Repository navigation
Conversation
…debar notes. See #66514.
|
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:
|
There was a problem hiding this comment.
🟡 Changes recommended
The tests leave two coverage gaps: the null-title input is normalized into a missing title, and direct registration does not verify the init hook.
2 open issues
What changed in this PR
Adds PHPUnit coverage for the Widget Group block’s server-side rendering and sidebar-tracking helpers, without changing production behavior.
Changes:
- Tests title markup, escaping, missing titles, inner-block ordering, and ignored content.
- Covers sidebar tracking, action hooks, and sidebar-specific rendering.
- Checks block registration and its render callback.
| File | Description |
|---|---|
tests/phpunit/tests/blocks/renderWidgetGroup.php |
Adds rendering, sidebar-tracking, and registration tests with setup and cleanup of sidebar globals. |
Review effort: Balanced
…name the registration test. See #66514.
…up tests. See #66514.

Adds unit tests for the functions in
src/wp-includes/blocks/widget-group.php, which were not referenced by any test. No behavior is changed.The new test class
tests/phpunit/tests/blocks/renderWidgetGroup.phpcovers:render_block_core_widget_group()<h2 class="widget-title">heading without a sidebar, or when the sidebar being rendered is not registered, and thebefore_titleandafter_titleof the sidebar being rendered when it is registered.wp-widget-group__inner-blockswrapper, and the$contentthat is passed is ignored.note_sidebar_being_rendered()dynamic_sidebar_beforeaction.register_block_core_widget_group()core/widget-groupwithrender_block_core_widget_groupas the render callback.discard_sidebar_being_rendered()is only checked to be hooked todynamic_sidebar_after. It callsunset()on a variable declared withglobal, which removes only the local reference and leaves$_sidebar_being_renderedset, so I did not assert that the global is cleared.Testing:
vendor/bin/phpunit --filter Tests_Blocks_RenderWidgetGroupvendor/bin/phpunit -c tests/phpunit/multisite.xml --filter Tests_Blocks_RenderWidgetGroupvendor/bin/phpcs tests/phpunit/tests/blocks/renderWidgetGroup.phpI also temporarily broke the functions (removing the escaping, the title check, the sidebar lookup, the rendering of the inner blocks, the noting of the sidebar, each of the two hooks and the render callback, and swapping the before and after title markup) and confirmed that a new test fails for each one.
Trac ticket: https://core.trac.wordpress.org/ticket/66514
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Written with AI and manually reviewed by me.
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.