Skip to content

Tests: Make data providers in shortcode.php static - #14793

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

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

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Makes the data providers in tests/phpunit/tests/shortcode.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_strip_shortcodes() to public static
  • Convert data_escaping() to public static
  • Convert data_escaping2() to public static
  • Convert data_registration_bad() to public static
  • Convert data_registration_good() to public static
  • Convert data_whole_posts() to public static

Test-only; no production code changes.

Testing Instructions

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

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 changes only add static declarations to providers that do not depend on test-instance state; tests were not run.

No open issues 🎉

What changed in this PR

Updates shortcode test data providers to static methods, aligning them with current PHPUnit usage in WordPress Core.

Changes:

  • Converts all six listed data providers to public static.
  • Leaves provider data, test references, and production code unchanged.
File Description
tests/​phpunit/​tests/​shortcode.php Makes six instance-independent 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