Skip to content

Tests: Use unregister_post_type() in Tests_User_MapMetaCap - #15446

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65893-clean-up-map-meta-cap
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65893-clean-up-map-meta-cap

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

Uses unregister_post_type() instead of manually unsetting the global registry in Tests_User_MapMetaCap::wpTearDownAfterClass().

Trac ticket: https://core.trac.wordpress.org/ticket/65893

@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 devmuhib.

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.

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 reported for the teardown change to use unregister_post_type().

No open issues 🎉

What changed in this PR

Updates Tests_User_MapMetaCap teardown to use WordPress’s post-type cleanup API.

Changes:

  • Replaces direct removal from $GLOBALS['wp_post_types'] with unregister_post_type() in wpTearDownAfterClass().
File Description
tests/​phpunit/​tests/​user/​mapMetaCap.php Uses unregister_post_type() to clean up the test post type.

Review effort: Balanced

@huzaifaalmesbah huzaifaalmesbah 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 @devmuhib009!

Properly cleans up the custom post type using core unregister_post_type() in Tests_User_MapMetaCap::wpTearDownAfterClass(). Clean and correct.

AI Review: Gemini 3.8 Flash

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.

3 participants