Skip to content

Tests: Make XML-RPC data providers static - #14972

Closed
robelsust wants to merge 4 commits into
WordPress:trunkfrom
robelsust:feature/66211-xmlrpc-static-data-providers
Closed

robelsust wants to merge 4 commits into
WordPress:trunkfrom
robelsust:feature/66211-xmlrpc-static-data-providers

Conversation

@robelsust

Copy link
Copy Markdown

Description

Trac ticket: #66211

Declares 9 data providers across tests/phpunit/tests/xmlrpc/ as public static for compatibility with newer PHPUnit versions (PHPUnit 10 deprecated non-public/non-static data providers, and PHPUnit 11 removed support for them).

All datasets and assertions are preserved untouched.

Testing Instructions

Run PHPUnit test suite:

  1. npm run test:php -- tests/phpunit/tests/xmlrpc/demo/addTwoNumbers.php tests/phpunit/tests/xmlrpc/wp/newComment.php tests/phpunit/tests/xmlrpc/wp/uploadFile.php
  2. npm run test:php -- -c tests/phpunit/multisite.xml tests/phpunit/tests/xmlrpc/demo/addTwoNumbers.php tests/phpunit/tests/xmlrpc/wp/newComment.php tests/phpunit/tests/xmlrpc/wp/uploadFile.php
  3. npm run test:php -- --group xmlrpc

Declare 9 data providers across tests/phpunit/tests/xmlrpc/ as public static for compatibility with newer PHPUnit versions. Preserve existing datasets and assertions.

See #66211.
@github-actions

github-actions Bot commented Oct 27, 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 therssoftware, 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.

* }
*/
public function data_comments_observe_post_permissions() {
public static function data_comments_observe_post_permissions() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other 8 providers in this PR declare an : array return type. Adding it here would keep them consistent:

Suggested change
public static function data_comments_observe_post_permissions() {
public static function data_comments_observe_post_permissions(): array {

…s().

Keeps the return type declaration consistent with the other data providers in the XML-RPC test suite.

See #66211.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The XML-RPC data-provider compatibility updates have no active review issues.

No open issues 🎉

What changed in this PR

Updates nine XML-RPC test data providers to public static for compatibility with newer PHPUnit versions, without changing datasets or assertions.

Changes:

  • Makes five upload-file, one new-comment, and three addition-test providers static.
  • Adds an array return type to the new-comment provider.
File Description
tests/​phpunit/​tests/​xmlrpc/​wp/​uploadFile.php Makes five attachment-validation providers static.
tests/​phpunit/​tests/​xmlrpc/​wp/​newComment.php Makes the comment-permissions provider static and adds an array return type.
tests/​phpunit/​tests/​xmlrpc/​demo/​addTwoNumbers.php Makes three argument-validation providers static.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datasets, assertions, and fixture lifetimes are preserved. The complete batch and unchanged trunk each passed randomized single-site and multisite runs: 542 tests and 1,268 assertions per mode, seed 66211. PHPCS passed all 12 changed files. Copilot reported no issues.

The earlier request for an array return type on the comment-permissions provider is addressed.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 29, 2026
Declare 52 data providers in the dependency, term-data block binding, and XML-RPC tests as `public static` for compatibility with newer PHPUnit versions.

Make three script helpers static and call them with `self::` from provider callbacks, preserving execution after test setup. Add the `array` return type to the comment-permissions provider. Preserve all datasets and assertions.

Developed in: #14908, #14971, #14972

Props huzaifaalmesbah, rejaulalomkhan, therssoftware, mukesh27, shailu25.
See #66211.


git-svn-id: https://develop.svn.wordpress.org/trunk@65029 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 29, 2026
Declare 52 data providers in the dependency, term-data block binding, and XML-RPC tests as `public static` for compatibility with newer PHPUnit versions.

Make three script helpers static and call them with `self::` from provider callbacks, preserving execution after test setup. Add the `array` return type to the comment-permissions provider. Preserve all datasets and assertions.

Developed in: WordPress/wordpress-develop#14908, WordPress/wordpress-develop#14971, WordPress/wordpress-develop#14972

Props huzaifaalmesbah, rejaulalomkhan, therssoftware, mukesh27, shailu25.
See #66211.

Built from https://develop.svn.wordpress.org/trunk@65029


git-svn-id: http://core.svn.wordpress.org/trunk@64179 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.

4 participants