Skip to content

Tests: Make data providers in tests/phpunit/tests/admin/includes/misc/ public static - #15309

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/66211-admin-misc-static-data-providers
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/66211-admin-misc-static-data-providers

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

Under Trac ticket #66211 and following committer guidance (Trac #66211 comment 109) to consolidate changes per directory, this PR updates all remaining data provider methods across tests/phpunit/tests/admin/includes/misc/ to be public static.

Trac ticket: https://core.trac.wordpress.org/ticket/66211

What

Declare data provider methods as public static across tests/phpunit/tests/admin/includes/misc/:

  • Tests_got_mod_rewrite::data_got_mod_rewrite() in tests/phpunit/tests/admin/includes/misc/gotModRewrite.php
  • Tests_iis7_add_rewrite_rule::data_iis7_add_rewrite_rule() in tests/phpunit/tests/admin/includes/misc/iis7AddRewriteRule.php
  • Tests_iis7_rewrite_rule_exists::data_iis7_rewrite_rule_exists() in tests/phpunit/tests/admin/includes/misc/iis7RewriteRuleExists.php
  • Tests_wp_make_plugin_file_tree::data_wp_make_plugin_file_tree() in tests/phpunit/tests/admin/includes/misc/wpMakePluginFileTree.php

Why

PHPUnit 10+ requires data providers to be public static. These methods do not use $this and return static datasets, so declaring them public static prepares the test suite for modern PHPUnit versions without changing test behavior.

Testing Instructions

Run the test suite and coding standards check:

vendor/bin/phpunit tests/phpunit/tests/admin/includes/misc/
vendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/admin/includes/misc/
vendor/bin/phpcs tests/phpunit/tests/admin/includes/misc/

All tests pass cleanly.

…/ public static. See #66211. Props devmuhib009.
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props devmuhib.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@huzaifaalmesbah huzaifaalmesbah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! No non-static provider is left in admin/includes/misc/ now. LGTM.

AI Review: Opus 5.5

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

No active review issues block the change to make four data providers static for PHPUnit 10+ compatibility.

No open issues 🎉

What changed in this PR

Prepares the admin miscellaneous tests for PHPUnit 10+ by making four data providers public static, supporting the test-suite modernization tracked in Trac #66211.

Changes:

  • Adds static to the four provider declarations.
  • Leaves datasets and test logic unchanged.
File Description
tests/​phpunit/​tests/​admin/​includes/​misc/​wpMakePluginFileTree.php Makes the plugin file tree provider static.
tests/​phpunit/​tests/​admin/​includes/​misc/​iis7RewriteRuleExists.php Makes the rewrite-rule existence provider static.
tests/​phpunit/​tests/​admin/​includes/​misc/​iis7AddRewriteRule.php Makes the rewrite-rule addition provider static.
tests/​phpunit/​tests/​admin/​includes/​misc/​gotModRewrite.php Makes the Apache rewrite detection provider static.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changed code against the implementation and existing coverage; no blocking issue found.

Validated with the related provider/factory patches on current trunk: 1,108 tests and 2,503 assertions in each of single-site and multisite, randomized seed 1101. The same two environment-dependent skips occurred before and after; no failures or errors.

Current-head CI and Copilot review checked.

AI review · gpt-6

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.

4 participants