Repository navigation
Tests: Make data providers in functions, media, meta, and vars tests public static - #15310
devmuhib009 wants to merge 1 commit into
Conversation
…public static. See #66211. Props devmuhib009.
|
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:
|
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks! All four providers are static and nothing else changes. LGTM.
AI Review: Opus 5.5
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the PHPUnit 10+ data-provider compatibility change.
No open issues 🎉
What changed in this PR
This PR prepares four WordPress test data providers for PHPUnit 10+ by declaring them public static, supporting the compatibility work tracked in Trac #66211.
Changes:
- Updates provider declarations in the functions, media, meta, and vars tests.
- Leaves datasets and test assertions unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/vars.php |
Makes the mobile-detection data provider static. |
tests/phpunit/tests/meta.php |
Makes the nonexistent-object metadata provider static. |
tests/phpunit/tests/media/getMediaEmbeddedInContent.php |
Makes the embedded-media content provider static. |
tests/phpunit/tests/functions/_wpCheckExistingFileNames.php |
Makes the existing-filename check provider static. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
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
Update post, database, view configuration, bookmark, admin, media, metadata, and variable test providers for newer PHPUnit versions. Use static calls for the media dimension helpers without changing datasets or assertions. Developed in: #15270, #15308, #15309, #15310, #15311 Props shailu25, rejaulalomkhan, devmuhib, huzaifaalmesbah. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@65162 602fd350-edb4-49c9-b593-d223f7449a82
Update post, database, view configuration, bookmark, admin, media, metadata, and variable test providers for newer PHPUnit versions. Use static calls for the media dimension helpers without changing datasets or assertions. Developed in: WordPress/wordpress-develop#15270, WordPress/wordpress-develop#15308, WordPress/wordpress-develop#15309, WordPress/wordpress-develop#15310, WordPress/wordpress-develop#15311 Props shailu25, rejaulalomkhan, devmuhib, huzaifaalmesbah. See #66211. Built from https://develop.svn.wordpress.org/trunk@65162 git-svn-id: http://core.svn.wordpress.org/trunk@64311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15310 landed in https://core.trac.wordpress.org/changeset/65162 |
Under Trac ticket #66211 and following committer guidance (Trac #66211 comment 109), this PR updates data provider methods across single-test files in
functions,media,meta, andvarsto bepublic static.Trac ticket: https://core.trac.wordpress.org/ticket/66211
What
Declare data provider methods as
public static:Tests_Functions__WpCheckExistingFileNames::data_wp_check_existing_file_names()intests/phpunit/tests/functions/_wpCheckExistingFileNames.phpTests_Media_GetMediaEmbeddedInContent::data_content()intests/phpunit/tests/media/getMediaEmbeddedInContent.phpTests_Meta::data_get_metadata_with_non_existent_object_id()intests/phpunit/tests/meta.phpTests_Vars::get_data_to_test_wp_is_mobile()intests/phpunit/tests/vars.phpWhy
PHPUnit 10+ requires data providers to be
public static. These methods do not use$thisand return static datasets, so declaring thempublic staticprepares the test suite for modern PHPUnit versions without changing test behavior.Testing Instructions
Run the test suite and coding standards check:
All tests pass cleanly.