Skip to content

Tests: Clean up custom post types in Tests_Link_GetDeletePostLink - #15495

Closed
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-cpt-get-delete-post-link
Closed

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-cpt-get-delete-post-link

Conversation

@devmuhib009

@devmuhib009 devmuhib009 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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

Remove the redundant unregister call for cpt_delete_test. Preserve the separate case that exercises an unregistered post type. Core resets these registrations before the next test.

@github-actions

github-actions Bot commented Nov 5, 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, 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 or WordPress.org 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

Copy link
Copy Markdown
Member

Thanks, @devmuhib009. Holding this one for now, along with the rest of this series; see https://core.trac.wordpress.org/ticket/65893#comment:656 for why.

AI review · claude-opus-5-5

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 recorded for the change centralizing custom post type cleanup in test teardown.

No open issues 🎉

What changed in this PR

Centralizes custom post type cleanup in Tests_Link_GetDeletePostLink::tear_down() to improve test isolation.

Changes:

  • Unregisters cpt_unreg_test and cpt_delete_test during teardown.
  • Removes the redundant cpt_delete_test unregistration from the individual test.
File Description
tests/​phpunit/​tests/​link/​getDeletePostLink.php Moves custom post type cleanup into the shared teardown method.

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.

Please drop both added teardown calls and retain only removal of the cpt_delete_test cleanup. Its result is already captured before that call. Preserve the in-test cpt_unreg_test unregister: it creates the missing-post-type scenario. Inherited setup resets ordinary registrations; the proposed extra class-boundary cleanup has no demonstrated affected consumer.

AI review · gpt-6

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 remain for the change simplifying cleanup in the custom-post-type delete-link test.

No open issues 🎉

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.

The delete-link test captures its result before the deleted cleanup. The separate test that needs an unregistered post type still unregisters it. The affected classes passed locally in randomized order on single site and multisite. Thanks for narrowing this.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 24, 2026
Remove duplicate cleanup for ordinary post types. Use `unregister_post_type()` where the test needs a type to disappear before an assertion.

Developed in: #15489, #15491, #15492, #15493, #15495, #15496

Props devmuhib, peterwilsoncc.
See #66755.


git-svn-id: https://develop.svn.wordpress.org/trunk@65757 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants