Skip to content

Tests: Make data providers in tests/phpunit/tests/rest-api/wpRestUrlDetailsController/ public and static - #15104

Closed
rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-static-dp-rest-url-details-controller
Closed

rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-static-dp-rest-url-details-controller

Conversation

@rejaulalomkhan

Copy link
Copy Markdown

Description

Per Trac #66211 and committer feedback (Comment 109), this PR updates data providers in the entire tests/phpunit/tests/rest-api/wpRestUrlDetailsController/ directory to be public static.

PHPUnit data providers that do not rely on test state or $this should be declared as public static to optimize test execution performance and comply with modern PHPUnit standards.

Data providers updated in tests/phpunit/tests/rest-api/wpRestUrlDetailsController/parsing.php:

  • data_get_title() -> public static function
  • data_get_icon() -> public static function
  • data_get_description() -> public static function
  • data_get_image() -> public static function

Testing Instructions

  1. Run vendor/bin/phpunit tests/phpunit/tests/rest-api/wpRestUrlDetailsController/parsing.php -> PASS (80 tests, 80 assertions).
  2. Run vendor/bin/phpcs tests/phpunit/tests/rest-api/wpRestUrlDetailsController/ -> PASS (0 errors, 0 warnings).

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


Use of AI Tools

  • Tool: Google Antigravity / Gemini 2.5 Pro
  • Purpose: Audited tests/phpunit/tests/rest-api/wpRestUrlDetailsController/ directory, converted data providers to public static, and verified via PHPUnit/PHPCS. All changes inspected and verified locally before submission.

…etailsController/ public and static

See #66211.
@github-actions

github-actions Bot commented Oct 28, 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 rejaulalomkhan, mukesh27.

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.

@mukeshpanchal27

Copy link
Copy Markdown
Member

This change to tests/phpunit/tests/rest-api/wpRestUrlDetailsController/parsing.php is identical to the one in #14907, which converts all of rest-api/. Could one of the two be closed so they don't conflict when the other lands?

@rejaulalomkhan

Copy link
Copy Markdown
Author

Closing in favor of #14907 which covers the full rest-api/ directory consolidation. Thanks @mukeshpanchal27!

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.

2 participants