Skip to content

Tests: Clean up custom taxonomy in Tests_Block_Bindings_Term_Data_Source - #15502

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

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

Conversation

@devmuhib009

@devmuhib009 devmuhib009 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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

Remove the two trailing unregister calls for wptests_private_tax in the term block binding tests. Core resets these registrations before the next test.

@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 or WordPress.org 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

@devmuhib009
devmuhib009 force-pushed the test/cleanup-taxonomy-block-bindings-term-data-source branch from b1fef41 to ebf574a Compare November 24, 2026 04:57
@lancewillett lancewillett moved this from In progress to In review in WordPress Project Build Tooling Nov 24, 2026
@lancewillett
lancewillett requested a balanced review from Copilot November 24, 2026 14:49

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

The taxonomy-cleanup change has no active review issues requiring resolution.

No open issues 🎉

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.

Both block-binding tests finish using the private taxonomy before the deleted cleanup. Core resets that ordinary taxonomy before the next test. The affected classes passed locally in randomized order on single site and multisite. Thanks for narrowing this.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 24, 2026
The test harness resets the private block-binding and category test taxonomies before the next test.

Developed in: #15502, #15503

Props devmuhib, peterwilsoncc.
See #66755.


git-svn-id: https://develop.svn.wordpress.org/trunk@65761 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 24, 2026
The test harness resets the private block-binding and category test taxonomies before the next test.

Developed in: WordPress/wordpress-develop#15502, WordPress/wordpress-develop#15503

Props devmuhib, peterwilsoncc.
See #66755.

Built from https://develop.svn.wordpress.org/trunk@65761


git-svn-id: http://core.svn.wordpress.org/trunk@64790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants