Skip to content

Tests: Make pattern overrides block bindings data providers static - #14970

Closed
rejaulalomkhan wants to merge 2 commits into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-static-dp-block-bindings-pattern-overrides
Closed

rejaulalomkhan wants to merge 2 commits into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-static-dp-block-bindings-pattern-overrides

Conversation

@rejaulalomkhan

@rejaulalomkhan rejaulalomkhan commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Description

Makes the two data providers in tests/phpunit/tests/block-bindings/patternOverridesSource.php public static: data_empty_metadata_names() and data_override_values_and_types(). PHPUnit 10+ requires static data providers, and neither uses instance state.

Refreshed against trunk after r64987, which removed data_empty_context() and trimmed the other two providers. Their current datasets are unchanged, and test_get_value_returns_null_when_context_empty() stays without a provider.

Testing

vendor/bin/phpunit --filter Tests_Block_Bindings_Pattern_Overrides_Source
vendor/bin/phpunit -c tests/phpunit/multisite.xml --filter Tests_Block_Bindings_Pattern_Overrides_Source
vendor/bin/phpunit --filter Tests_Block_Bindings_Pattern_Overrides_Source --order-by=random --random-order-seed=12345
vendor/bin/phpcs tests/phpunit/tests/block-bindings/patternOverridesSource.php

All pass (13 tests, 16 assertions); PHPCS: no errors.

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


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Use of AI Tools

AI assistance: Yes
Tool(s): Google Antigravity (original change), Claude Code (review follow-up)
Model(s): Gemini 2.5 Pro, Claude Opus 5.5
Used for: Converting the providers, then merging trunk after r64987 and running the tests. I reviewed every line and take responsibility for the change.

Declare data providers in tests/phpunit/tests/block-bindings/patternOverridesSource.php as public static for compatibility with newer PHPUnit versions.

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 rejaulalomkhan, shailu25, mukesh27, lancewillett.

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.

@shail-mehta shail-mehta 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.

LGTM👍

Providers don't use instance state, so making them static looks correct.

As per Lance's note on #66211, Please group by directory (or ~6–8 files) for follow-ups instead of one PR per file.

@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.

Please refresh this against trunk. r64987 removed data_empty_context() and trimmed the other two providers, so the current patch no longer applies.

Keep that cleanup intact and make only the two surviving providers static: data_empty_metadata_names() and data_override_values_and_types(). Please preserve their current datasets and leave test_get_value_returns_null_when_context_empty() without a provider.

AI review · gpt-6

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

No active review issues remain for the PHPUnit 10+ data-provider compatibility update.

No open issues 🎉

What changed in this PR

Updates the pattern overrides block bindings tests for PHPUnit 10+ compatibility by declaring all three affected data providers public static.

Changes:

  • Converts data_empty_metadata_names(), data_empty_context(), and data_override_values_and_types() to static methods.
  • Leaves test datasets and assertions unchanged.
File Description
tests/​phpunit/​tests/​block-bindings/​patternOverridesSource.php Makes three data providers static to meet PHPUnit 10+ requirements.

Review effort: Balanced

# Conflicts:
#	tests/phpunit/tests/block-bindings/patternOverridesSource.php
@rejaulalomkhan

Copy link
Copy Markdown
Member Author

@lancewillett Merged trunk (f86841c). The file now matches trunk apart from data_empty_metadata_names() and data_override_values_and_types() becoming static; the r64987 cleanup and datasets are unchanged, and test_get_value_returns_null_when_context_empty() has no provider.

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

No active review issues are reported for the PHPUnit data-provider compatibility update.

No open issues 🎉

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.

The refresh preserves the trunk cleanup and datasets; only the two surviving providers change to static.

Static checks passed. The affected classes passed together in randomized single-site and multisite runs: 408 tests and 1,383 assertions in each mode.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 31, 2026
Convert the remaining providers and fixture callbacks to static methods. Preserve datasets, expectations, and the already-landed provider cleanup.

Developed in: #14970, #15176, #15180

Props rejaulalomkhan, shailu25, mukesh27.
See #66211.


git-svn-id: https://develop.svn.wordpress.org/trunk@65128 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 31, 2026
Convert the remaining providers and fixture callbacks to static methods. Preserve datasets, expectations, and the already-landed provider cleanup.

Developed in: WordPress/wordpress-develop#14970, WordPress/wordpress-develop#15176, WordPress/wordpress-develop#15180

Props rejaulalomkhan, shailu25, mukesh27.
See #66211.

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


git-svn-id: http://core.svn.wordpress.org/trunk@64277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

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.

5 participants