Skip to content

Tests: Make data providers in filters.php static - #14790

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

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

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Makes the data providers in tests/phpunit/tests/filters.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_priority_callback_order_with_integers() to public static
  • Convert data_priority_callback_order_with_unhappy_path_nonintegers() to public static

Test-only; no production code changes.

Testing Instructions

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

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 return literal arrays without instance dependencies, so these declaration-only changes preserve behavior.

No open issues 🎉

What changed in this PR

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

Changes:

  • Converts the integer and non-integer priority data providers to public static, preserving their data and existing test references.
File Description
tests/​phpunit/​tests/​filters.php Makes both priority callback order data providers static.

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