Repository navigation
Tests: Clean up custom post type in Tests_User_GetTheAuthorPosts - #15452
devmuhib009 wants to merge 1 commit into
Conversation
See #65893. Props devmuhib009.
|
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:
|
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks @devmuhib009!
Properly unregisters the wptests_pt custom post type in tear_down() and removes the mid-test unregistration call in Tests_User_GetTheAuthorPosts, preventing fixture leakage across test suites. Looks good to me!
AI Review: Gemini 3.8 Flash
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change moving custom post type cleanup into the test teardown lifecycle.
No open issues 🎉
What changed in this PR
Moves custom post type cleanup into the test teardown lifecycle to prevent fixture leakage in Tests_User_GetTheAuthorPosts.
Changes:
- Adds
tear_down()to unregisterwptests_ptusing the public API before calling the parent teardown. - Removes the internal
_unregister_post_type()call from the test body.
| File | Description |
|---|---|
tests/phpunit/tests/user/getTheAuthorPosts.php |
Moves custom post type cleanup into teardown using unregister_post_type(). |
Review effort: Balanced
Trac ticket: https://core.trac.wordpress.org/ticket/65893
This PR ensures the custom post type
wptests_ptregistered during tests inTests_User_GetTheAuthorPostsis cleanly unregistered intear_down()using the publicunregister_post_type()function, preventing fixture leakage and replacing the internal mid-test call.