Repository navigation
Tests: Remove redundant post type cleanup in wpRestIconCollectionsController - #16269
shail-mehta wants to merge 3 commits into
Conversation
…st_date_query_with_taxonomy_join()
…uery::test_date_query_with_taxonomy_join()" This reverts commit 9fc35fb.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the teardown cleanup simplification.
No open issues 🎉
What changed in this PR
Simplifies teardown in the REST icon collections controller tests by removing custom post type cleanup already handled by the shared test setup.
Changes:
- Removes the existence check and unregister call for
rest_icon_cpt. - Preserves icon collection cleanup and the parent teardown call.
| File | Description |
|---|---|
tests/phpunit/tests/icons/wpRestIconCollectionsController.php |
Removes redundant custom post type cleanup from tear_down(). |
Review effort: Balanced
|
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:
|
lancewillett
left a comment
There was a problem hiding this comment.
The inherited setup removes the custom post type. The class still unregisters its icon collections, which use a separate registry. I also checked the class-level user deletion: this post type has no author support or delete-with-user setting.
AI review · gpt-6.2-astra
… classes. Core resets these registrations before each test. Remove the trailing unregister calls from the admin bar, query, REST icon collection and block template tests. Keep the icon collection cleanup for its separate registry. Developed in: #16267, #16268, #16269, #16272, #16274 Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65815 602fd350-edb4-49c9-b593-d223f7449a82
… classes. Core resets these registrations before each test. Remove the trailing unregister calls from the admin bar, query, REST icon collection and block template tests. Keep the icon collection cleanup for its separate registry. Developed in: WordPress/wordpress-develop#16267, WordPress/wordpress-develop#16268, WordPress/wordpress-develop#16269, WordPress/wordpress-develop#16272, WordPress/wordpress-develop#16274 Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27. See #66755. Built from https://develop.svn.wordpress.org/trunk@65815 git-svn-id: http://core.svn.wordpress.org/trunk@64844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #16269 landed in https://core.trac.wordpress.org/changeset/65815 |
Trac ticket: #66755
What
Removes the
post_type_exists( 'rest_icon_cpt' )check andunregister_post_type( 'rest_icon_cpt' )call fromTests_REST_WpRestIconCollectionsController::tear_down().Why
rest_icon_cptis registered only insidetest_get_items_allows_custom_post_type_edit_capability(). Its registration is part of that test's scenario, and nothing else in the test suite uses the name.WP_UnitTestCase_Base::set_up()already resets ordinary custom post types before every core test viareset_post_types()(tests/phpunit/includes/abstract-testcase.php). So the next test starts withoutrest_icon_cptregistered, and the teardown unregister adds nothing for later tests in this class.No class-level setup registers
rest_icon_cpt, and no other test class uses it. A registration left behind by the last test therefore cannot affect a later class'swpSetUpBeforeClass().How
Delete the
post_type_exists()guard andunregister_post_type()call fromtear_down(). Keep the loop that unregisters the three icon collections, becausewp_unregister_icon_collection()resets a registry that the core reset does not cover.Testing Instructions
Run the class in default and reverse order, and the
iconsgroup:Use of AI Tools