Skip to content

Tests: Clean up custom taxonomy in Tests_Block_Bindings_Term_Data_Source - #15502

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-taxonomy-block-bindings-term-data-source
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-taxonomy-block-bindings-term-data-source

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

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

This PR cleans up the custom taxonomy wptests_private_tax in Tests_Block_Bindings_Term_Data_Source::tear_down() using the public unregister_taxonomy() function, and removes redundant mid-test unregistration calls.

@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 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 remain for the change centralizing private-taxonomy cleanup in per-test teardown.

No open issues 🎉

What changed in this PR

Centralizes private-taxonomy cleanup in the term-data block binding tests, ensuring cleanup runs even when an assertion fails.

Changes:

  • Adds tear_down() to call the public unregister_taxonomy() API before parent teardown.
  • Removes redundant cleanup calls from the two private-taxonomy access tests.
File Description
tests/​phpunit/​tests/​block-bindings/​termDataSource.php Moves wptests_private_tax cleanup into shared per-test teardown.

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 keep the deletion of the two trailing _unregister_taxonomy() calls, but omit the new tear_down() method. In Core tests, inherited set_up() already resets taxonomies before the next test; _unregister_taxonomy() already delegates to the public API, so changing its spelling adds no benefit.

I compared trunk, this four-PR batch, and a deletion-only alternative: all pass 197 tests / 573 assertions in single site and multisite. Ordered existing tests across class boundaries also pass before/after deletion (10 tests / 66 assertions). Class fixtures run before the next reset, but I found no existing consumer that fails without this new teardown. Its isolation benefit remains unproven. The smaller deletion-only patch preserves all assertions and avoids new per-test machinery.

AI review · gpt-6

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

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants