Skip to content

Tests: Make data providers in tests/phpunit/tests/blocks/register.php public and static - #14954

Closed
rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-blocks-register-data-providers
Closed

rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/66211-blocks-register-data-providers

Conversation

@rejaulalomkhan

Copy link
Copy Markdown

Description

In tests/phpunit/tests/blocks/register.php, several data provider methods were declared as non-static.

Declaring data providers as public static aligns with modern PHPUnit best practices and requirements for PHPUnit 10+.

This PR updates the following data provider methods to public static:

  • data_register_block_style_handle_uses_correct_core_stylesheet
  • data_register_block_registers_with_args_override_returns_false_when_name_is_missing
  • data_register_block_type_accepts_editor_script_array
  • data_register_block_type_throws_doing_it_wrong
  • data_register_block_style_name_contains_spaces

Testing Instructions

Run the block registration unit tests:

vendor/bin/phpunit tests/phpunit/tests/blocks/register.php

Run PHPCS verification:

vendor/bin/phpcs tests/phpunit/tests/blocks/register.php

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

Use of AI Tools

AI assistance: Yes
Tool(s): Google Antigravity
Model(s): Gemini 3.8 Flash
Used for: Scanning data provider signatures and verifying absence of $this state; static method conversion and local PHPCS/PHPUnit verification were reviewed and validated by me.


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.

… public and static

Data providers should be declared public static to align with modern PHPUnit best practices and requirements.

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, mukesh27, huzaifaalmesbah.

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.

@huzaifaalmesbah

Copy link
Copy Markdown
Member

Hi @rejaulalomkhan! Thanks for working on this.

Per Lance's feedback on Trac #66211, committers requested sending one PR per directory rather than individual single-file PRs to keep review and SVN commits manageable.

In tests/phpunit/tests/blocks/, there are a few other files with data providers that could be included in this PR so the entire directory is covered at once:

  • tests/phpunit/tests/blocks/editor.php
  • tests/phpunit/tests/blocks/render.php
  • tests/phpunit/tests/blocks/supportedStyles.php
  • tests/phpunit/tests/blocks/wpBlock.php
  • tests/phpunit/tests/blocks/wpBlockParser.php
  • tests/phpunit/tests/blocks/wpBlockType.php

Would you like to add these files to this PR to complete the blocks directory?

@rejaulalomkhan

Copy link
Copy Markdown
Author

Closing in favor of consolidated directory PR #15180 which updates all data providers across tests/phpunit/tests/blocks/ per Trac #66211 comment 109.

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