Repository navigation
Tests: Clean up custom post types in Tests_Post_GetPostsByAuthorSql - #15454
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 custom post types foo, bar, and baz in tear_down() and cleans up the redundant mid-test unregistration calls in Tests_Post_GetPostsByAuthorSql. Verified random order execution. Looks good to me!
AI Review: Gemini 3.8 Flash
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change centralizing custom post type cleanup in teardown.
No open issues 🎉
What changed in this PR
This PR improves test isolation in Tests_Post_GetPostsByAuthorSql by centralizing custom post type cleanup in teardown.
Changes:
- Adds
tear_down()to unregisterfoo,bar, andbazusing the publicunregister_post_type()API before calling the parent teardown. - Removes inline
_unregister_post_type()calls so cleanup runs even when assertions fail.
| File | Description |
|---|---|
tests/phpunit/tests/post/getPostsByAuthorSql.php |
Centralizes custom post type cleanup to prevent fixture leakage between tests. |
Review effort: Balanced
Trac ticket: https://core.trac.wordpress.org/ticket/65893
This PR unregisters custom post types
foo,bar, andbazintear_down()using the publicunregister_post_type()function inTests_Post_GetPostsByAuthorSql, preventing fixture leakage across tests and removing internal mid-test unregistration calls.