Skip to content

Tests: Make data providers in abilities-api tests public and static - #13975

Closed
huzaifaalmesbah wants to merge 1 commit into
WordPress:trunkfrom
huzaifaalmesbah:test/66211-abilities-api-data-providers
Closed

huzaifaalmesbah wants to merge 1 commit into
WordPress:trunkfrom
huzaifaalmesbah:test/66211-abilities-api-data-providers

Conversation

@huzaifaalmesbah

Copy link
Copy Markdown
Member

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(): Made public static.
    • data_invalid_slug_provider(): Made public static.
  • tests/phpunit/tests/abilities-api/wpAbility.php:
    • data_execute_input(): Made public static.
    • data_validate_input_top_level_required(): Made public static.
    • data_execute_callback(): Made public 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 declared public static.

Testing Instructions

# Single site suite
npm run test:php -- --test-suffix .php tests/phpunit/tests/abilities-api/

# Multisite suite
npm run test:php -- -c tests/phpunit/multisite.xml --test-suffix .php tests/phpunit/tests/abilities-api/

# Code style check
composer run lint tests/phpunit/tests/abilities-api/wpAbility.php tests/phpunit/tests/abilities-api/wpAbilityCategoryRegistry.php

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.

Declare the data providers in tests/phpunit/tests/abilities-api/ as public static for compatibility with newer PHPUnit versions.

See #66211.
@github-actions

github-actions Bot commented Oct 4, 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. You can also manually ask me to refresh this list by adding the props-bot label.

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

Props huzaifaalmesbah, mukesh27.

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

@mukeshpanchal27

Copy link
Copy Markdown
Member

@huzaifaalmesbah Thanks for the PR!

Since the ticket is marked good-first-bug, it's intended for new contributors. As you're an experienced contributor, please avoid picking up good-first-bug tickets in the future so we can use them to help onboard and support new contributors.

Thanks for understanding!

@huzaifaalmesbah

huzaifaalmesbah commented Oct 4, 2026 •

Copy link
Copy Markdown
Member Author

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!

@lancewillett
lancewillett self-requested a review October 4, 2026 19:52
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit that referenced this pull request Oct 4, 2026
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
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 4, 2026
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
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.

3 participants