Tests: Make data providers in abilities-api tests public and static - #13975
huzaifaalmesbah wants to merge 1 commit into
Conversation
Declare the data providers in tests/phpunit/tests/abilities-api/ as public static for compatibility with newer PHPUnit versions. See #66211.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
|
@huzaifaalmesbah Thanks for the PR! Since the ticket is marked Thanks for understanding! |
|
Sorry about that, @mukeshpanchal27 I mainly picked this up to show a few new contributors the PR process. I’ll keep this in mind going forward. Thanks! |
|
PR #13975 landed in https://core.trac.wordpress.org/changeset/64088 |
Declare five data providers as `public static` for compatibility with newer PHPUnit versions. Use an anonymous object for the instance-method callback dataset so it no longer depends on `$this`, preserving coverage of object-method callables. Developed in: #13975 Props huzaifaalmesbah. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64088 602fd350-edb4-49c9-b593-d223f7449a82
Declare five data providers as `public static` for compatibility with newer PHPUnit versions. Use an anonymous object for the instance-method callback dataset so it no longer depends on `$this`, preserving coverage of object-method callables. Developed in: WordPress/wordpress-develop#13975 Props huzaifaalmesbah. See #66211. Built from https://develop.svn.wordpress.org/trunk@64088 git-svn-id: http://core.svn.wordpress.org/trunk@63247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Makes the PHPUnit data provider methods in
tests/phpunit/tests/abilities-api/public static, as part of the PHPUnit 10+ migration (#62004).PHPUnit 10 deprecated non-static data providers and PHPUnit 11 removed support for them. PHPUnit 9 accepts static providers, so this can land now.
Files changed:
tests/phpunit/tests/abilities-api/wpAbilityCategoryRegistry.php:data_valid_slug_provider(): Madepublic static.data_invalid_slug_provider(): Madepublic static.tests/phpunit/tests/abilities-api/wpAbility.php:data_execute_input(): Madepublic static.data_validate_input_top_level_required(): Madepublic static.data_execute_callback(): Madepublic static. The 'object method' test case now uses an anonymous class instance with the callback method instead of$this.Note:
wpAbilitiesRegistry.php's data provider (data_invalid_category_types) is already declaredpublic static.Testing Instructions
Expected result: 226 tests, 538 assertions (OK, 100% pass), 0 lint errors.
Trac ticket: https://core.trac.wordpress.org/ticket/66211
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Updating data provider signatures and testing. Implementation and test verification were reviewed and executed locally.