Skip to content

Tests: Make data provider in walkerCategory.php static - #14805

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

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

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

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

Test-only; no production code changes.

Testing Instructions

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

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 provider has no instance dependencies, and the single-line change preserves its behavior; tests were not run.

No open issues 🎉

What changed in this PR

Updates a category walker test data provider to follow PHPUnit’s static-provider requirements. No production code changes.

Changes:

  • Makes data_start_el_with_empty_attributes() public static, preserving its data and existing test reference.
File Description
tests/​phpunit/​tests/​category/​walkerCategory.php Converts the data provider to a static method.

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