Skip to content

Tests: Make data providers in term.php static - #14791

Draft
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-providers-term
Draft

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-providers-term

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Makes the data providers in tests/phpunit/tests/term.php static.

Why

PHPUnit data providers should be static so they do not depend on test instance state and remain compatible with current PHPUnit usage in Core.

How

  • Convert data_wp_set_term_objects_finds_term_name_with_special_characters() to public static
  • Convert data_get_term_filter() to public static

Test-only; no production code changes.

Testing Instructions

  1. npm run test:php -- --filter Tests_Term
  2. npm run test:php -- --filter Tests_Term -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Term --order-by=random
  4. npm run test:php -- --group taxonomy

Use of AI Tools

  • Cursor

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

Both providers are independent of test-instance state and compatible with static usage; tests were not run.

No open issues 🎉

What changed in this PR

Makes two term-test data providers static to align with current PHPUnit usage in WordPress Core. This is a test-only change with no production impact.

Changes:

  • Adds static to data_wp_set_term_objects_finds_term_name_with_special_characters().
  • Adds static to data_get_term_filter().
File Description
tests/​phpunit/​tests/​term.php Makes both data providers static without changing their returned data.

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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants