Skip to content

Tests: Make data provider in getLastCommentModified.php static - #14801

Draft
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-provider-get-last-comment-modified
Draft

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-static-data-provider-get-last-comment-modified

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Makes the data provider in tests/phpunit/tests/comment/getLastCommentModified.php static.

Why

PHPUnit data providers should be static so they do not depend on test instance state and remain compatible with current PHPUnit usage in Core.

How

  • Convert data_internal_comment_types_are_excluded() to public static

Test-only; no production code changes.

Testing Instructions

  1. npm run test:php -- --filter Tests_Comment_GetLastCommentModified
  2. npm run test:php -- --filter Tests_Comment_GetLastCommentModified -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Comment_GetLastCommentModified --order-by=random
  4. npm run test:php -- --group comment

Use of AI Tools

  • Cursor

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 provider has no instance-state dependencies, so the static declaration preserves its behavior and existing test usage.

No open issues 🎉

What changed in this PR

This test-only change makes a comment test data provider static, aligning it with PHPUnit data-provider requirements without changing production code.

Changes:

  • Declares data_internal_comment_types_are_excluded() as public static, preserving its literal datasets and existing test reference.
File Description
tests/​phpunit/​tests/​comment/​getLastCommentModified.php Makes the data provider static for PHPUnit compatibility.

Review effort: Balanced

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