Repository navigation
Conversation
…nus. Adds tests for `wp_admin_bar_edit_menu()`, `wp_admin_bar_edit_site_menu()` and `wp_admin_bar_appearance_menu()`, covering the front end edit links for posts, terms and users, the view and preview links in the admin, block and classic themes, capability checks and the theme feature dependent items. See #66491.
|
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 cleanup unsets background/header globals without restoring them, causing later tests to emit undefined-global warnings and making the suite order-dependent.
1 open issue
What changed in this PR
Adds the second group of Toolbar test coverage for ticket #66491, complementing #15521 without changing production behavior.
Changes:
- Covers front-end Edit links and admin View/Preview links across queried objects and capability checks.
- Tests Edit Site availability for block themes, permissions, and admin contexts.
- Tests appearance menu links based on user capabilities and theme support.
| File | Description |
|---|---|
tests/phpunit/tests/adminbar.php |
Adds tests for the Toolbar edit, Edit Site, and appearance menus. |
Review effort: Balanced
…ppearance menu test. `remove_theme_support()` unsets `$custom_background` and `$custom_image_header`, which restoring `$_wp_theme_features` does not bring back, so a later test reading them emitted an undefined global error. `add_theme_support()` only stores the feature, so restoring the saved features is enough. See #66491.
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for working on this, @hmbashar, and for the quick update! I really appreciate you taking the time to add comprehensive coverage for the Toolbar edit, Edit Site, and appearance menus—these functions build key parts of the admin bar and had very little direct test coverage before.
I left a small note inline.
AI Review: Gemini 3.8 Flash
…te menu test. Calling `unset()` on a variable declared with `global` only removes the local reference, so `$_wp_current_template_id` stayed set for the tests that run afterwards. See #66491.
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for the quick follow-up, @hmbashar! The global template ID cleanup in e6b044b2 looks great. Everything in this PR is now completely clean, well-tested, and ready to go.
AI Review: Gemini 3.8 Flash

Adds unit tests for the Toolbar (Admin Bar) edit, Edit Site and appearance menus in
tests/phpunit/tests/adminbar.php. This is the second group of the test coverage work proposed in the ticket, and is independent from the first group in #15521. No behavior is changed.Functions covered:
wp_admin_bar_edit_menu()wp_admin_bar_edit_site_menu()wp_admin_bar_appearance_menu()Testing:
vendor/bin/phpunit --filter Tests_AdminBarvendor/bin/phpunit -c tests/phpunit/multisite.xml --filter Tests_AdminBarvendor/bin/phpcs tests/phpunit/tests/adminbar.phpI also temporarily broke the related lines in
src/wp-includes/admin-bar.php(draft preview branch,edit_theme_optionsguard, Edit Site admin guard, publicly viewable term check, user view link) and confirmed that a new test fails for each one.Trac ticket: https://core.trac.wordpress.org/ticket/66491
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.