Repository navigation
Tests: Make data providers in tests/phpunit/tests/rest-api.php public and static - #15299
rejaulalomkhan wants to merge 1 commit into
Conversation
… and static Makes remaining data providers in `tests/phpunit/tests/rest-api.php` `public static` in preparation for PHPUnit 10: - `data_jsonp_callback_check` - `data_rest_parse_date` - `data_rest_parse_date_force_utc` - `data_rest_parse_embed_param` - `data_rest_filter_response_by_context` - `data_rest_ensure_response_returns_instance_of_wp_rest_response` - `data_rest_is_object` - `data_rest_sanitize_object` - `data_rest_is_array` - `data_rest_sanitize_array` - `data_rest_is_integer` - `data_get_best_type_for_value` - `data_rest_preload_api_request_embeds_links` See #66211.
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟢 Approval recommended
The PHPUnit 10+ data-provider compatibility update has no active review issues.
No open issues 🎉
What changed in this PR
Updates the remaining 13 data providers in the REST API test class to meet PHPUnit 10+ requirements, supporting the broader test compatibility work in Trac #66211.
Changes:
- Adds
staticto 13 existing public data provider methods. - Leaves datasets, test logic, and assertions unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/rest-api.php |
Converts the remaining 13 data providers to public static. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
The 13 providers are independent of instance state; their datasets and assertions are unchanged. PHPCS and randomized local single-site and multisite runs passed: 263 tests, 402 assertions in each mode.
AI review · gpt-6
Declare the remaining 13 data providers in `tests/phpunit/tests/rest-api.php` as `public static` for PHPUnit compatibility. Preserve existing datasets and assertions. Developed in: #15299 Props rejaulalomkhan, huzaifaalmesbah. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@65127 602fd350-edb4-49c9-b593-d223f7449a82
Declare the remaining 13 data providers in `tests/phpunit/tests/rest-api.php` as `public static` for PHPUnit compatibility. Preserve existing datasets and assertions. Developed in: WordPress/wordpress-develop#15299 Props rejaulalomkhan, huzaifaalmesbah. See #66211. Built from https://develop.svn.wordpress.org/trunk@65127 git-svn-id: http://core.svn.wordpress.org/trunk@64276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15299 landed in https://core.trac.wordpress.org/changeset/65127 |
Trac ticket: https://core.trac.wordpress.org/ticket/66211
What
Makes the remaining 13 data provider methods in
tests/phpunit/tests/rest-api.phppublic static.Why
PHPUnit 10+ requires data providers to be
public static. These providers only return datasets and do not use$this, so updating their visibility and static modifier brings them into compliance with PHPUnit 10 requirements and aligns with the broader effort on #66211.How
Update the following data provider methods to
public static function:data_jsonp_callback_check()data_rest_parse_date()data_rest_parse_date_force_utc()data_rest_parse_embed_param()data_rest_filter_response_by_context()data_rest_ensure_response_returns_instance_of_wp_rest_response()data_rest_is_object()data_rest_sanitize_object()data_rest_is_array()data_rest_sanitize_array()data_rest_is_integer()data_get_best_type_for_value()data_rest_preload_api_request_embeds_links()Datasets, test logic, and assertions are unchanged.
Testing Instructions
Run single-site and multisite test suites:
All 449 tests (962 assertions) pass on both suites with zero PHPCS errors.
Use of AI Tools
AI assistance: Yes
Tool: Antigravity
Model: Gemini 3.8 Flash
Used for: Static data provider conversion, local verification via PHPUnit/PHPCS, and PR description generation.