Skip to content

Tests: Make data provider in jquery.php static - #14804

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

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

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

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

Test-only; no production code changes.

Testing Instructions

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

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

The isolated declaration change is safe because the provider returns literal data and has no instance dependencies.

No open issues 🎉

What changed in this PR

This test-only change makes the jQuery data provider static, aligning it with current PHPUnit usage in Core without changing production code.

Changes:

  • Converts data_jquery_files_exist() to public static, preserving its data and existing test behavior.
File Description
tests/​phpunit/​tests/​dependencies/​jquery.php Makes the jQuery file-existence 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