Skip to content

Tests: Make data provider in cache.php static - #14799

Draft
shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-provider-cache
Draft

shail-mehta wants to merge 2 commits into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-provider-cache

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Makes the data provider in tests/phpunit/tests/cache.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_is_valid_key() to public static

Test-only; no production code changes.

Testing Instructions

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

Use of AI Tools

  • Cursor

@shail-mehta shail-mehta self-assigned this Oct 23, 2026
@shail-mehta
shail-mehta requested a balanced review from Copilot October 23, 2026 17:04

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 provider uses only literal data, so the static declaration preserves behavior without depending on test instance state.

No open issues 🎉

What changed in this PR

Makes the cache test data provider static to align with current PHPUnit usage in WordPress Core. This is a test-only change with no production impact.

Changes:

  • Converts data_is_valid_key() to public static, preserving its test data and existing provider reference.
File Description
tests/​phpunit/​tests/​cache.php Makes the cache key validation data provider 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