Skip to content

tests for wp_widgets_add_menu - #3699

Open
pbearne wants to merge 14 commits into
WordPress:trunkfrom
pbearne:57224_wp_widgets_add_menu
Open

pbearne wants to merge 14 commits into
WordPress:trunkfrom
pbearne:57224_wp_widgets_add_menu

Conversation

@pbearne

@pbearne pbearne commented Nov 29, 2022

Copy link
Copy Markdown

@mukeshpanchal27 mukeshpanchal27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pbearne Left some nit-pick.

pbearne and others added 7 commits December 2, 2022 15:13
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
@pbearne

pbearne commented Dec 2, 2022

Copy link
Copy Markdown
Author

@mukeshpanchal27 Thanks

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The tests remain order-dependent because they do not clear existing submenu entries, and one test fails to restore the original widget-support state.

2 open issues
What changed in this PR

Adds PHPUnit coverage for WordPress’s wp_widgets_add_menu() function, associated with Trac ticket #57224. No production code changes are included.

Changes:

  • Tests that no submenu is added without widget support.
  • Tests Widgets submenu placement with widget support and with block template parts enabled.
File Description
tests/​phpunit/​tests/​functions/​wpWidgetsAddMenu.php Adds three tests for Widgets submenu creation and placement.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a behavior/fixture refresh for current core: classic widgets now occupy index 9, and block-template-parts support no longer selects the block-theme branch. Please control the theme and submenu inputs before asserting the Widgets entry. This also overlaps #5830; consolidate the alternatives rather than landing both.

AI review · gpt-6

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

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:

Props pbearne, mukesh27, lancewillett.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@lancewillett
lancewillett requested a review from audrasjb November 4, 2026 21:29
Paul Bearne and others added 2 commits November 4, 2026 16:29
- Improve test structure and clarity.
- Add setup and teardown methods to manage global `$submenu`.
- Cover additional scenarios for widget and block theme support.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new test expects the Widgets submenu at index 7, but the existing implementation uses index 9, causing the test to fail.

1 open issue
2 resolved since last review

Review effort: Balanced

pbearne and others added 2 commits November 5, 2026 12:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test’s empty submenu allows it to pass even if existing Appearance entries are overwritten; it should seed an entry and verify that Widgets is appended at the next numeric index.

1 open issue
1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the added widget submenu tests.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants