Skip to content

Tests: Keep the test taxonomy available during term-parent fixture deletion - #15193

Open
lancewillett wants to merge 2 commits into
WordPress:trunkfrom
lancewillett:cleanup/registry-term-parent-lifecycle-65893
Open

lancewillett wants to merge 2 commits into
WordPress:trunkfrom
lancewillett:cleanup/registry-term-parent-lifecycle-65893

Conversation

@lancewillett

@lancewillett lancewillett commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

The per-test unregister_taxonomy() removes wptests_tax before the existing class teardown calls wp_delete_term(). A diagnostic of those existing calls returned false for both deletions before the change and true after removing only the per-test unregister, in single-site and multisite.

Remove the premature per-test teardown. Keep the final class-level unregister after both term deletions, preserving the existing class boundary. No assertions or production behavior change.

Follow-up to #15038. See https://core.trac.wordpress.org/ticket/65893.

Validation: PHP syntax and PHPCS passed. Randomized checks (seed 15193) passed 13 tests / 13 assertions in both modes, before and after. The diagnostic establishes the cleanup benefit; the green tests alone do not.

Prepared with AI assistance (gpt-6).

@lancewillett
lancewillett requested a balanced review from Copilot October 29, 2026 22:04
@github-actions

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 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 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 recorded for the test-fixture cleanup change.

No open issues 🎉

What changed in this PR

Fixes the test-fixture cleanup regression introduced by #15038 by keeping wptests_tax registered until class-level term deletion completes.

Changes:

  • Removes per-test teardown and class-level taxonomy unregister calls.
  • Preserves existing term deletion, relying on the next per-test setup to reset taxonomies.
  • Leaves assertions and production behavior unchanged.
File Description
tests/​phpunit/​tests/​term/​getTermParentsList.php Removes premature taxonomy cleanup so class teardown can delete fixture terms.

Review effort: Balanced

@lancewillett

Copy link
Copy Markdown
Member Author

Narrowed in a4db49e: keep the final class unregister after both term deletions. Only the premature per-test teardown is removed. This retains the demonstrated deletion fix and preserves the class boundary. Randomized single-site and multisite checks passed (13 tests / 13 assertions each). Peter’s independent review remains pending.

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

There are no active review issues with the test cleanup-ordering change.

No open issues 🎉

Review effort: Balanced

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

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants