Skip to content

Tests: Make data providers in tests/phpunit/tests/media.php public static - #15311

Closed
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/66211-media-static-data-providers
Closed

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/66211-media-static-data-providers

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

Under Trac ticket #66211 and following committer guidance (Trac #66211 comment 109) to consolidate changes per directory/file, this PR updates all remaining data provider methods across tests/phpunit/tests/media.php to be public static.

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

What

Declare 23 data provider methods and 2 static helpers as public static (or private static) in tests/phpunit/tests/media.php:

  • data_attachment_permalinks_based_on_parent_status()
  • data_autoembed()
  • data_get_filters_with_do_shortcode_callback()
  • data_image_converted_to_other_format_has_correct_filename()
  • data_image_with_existing_auto_sizes()
  • data_provider_data_provider_to_test_wp_enqueue_img_auto_sizes_contain_css_fix()
  • data_provider_fetchpriority_values()
  • data_provider_to_test_wp_img_tag_add_auto_sizes()
  • data_special_contexts_for_the_content()
  • data_special_contexts_for_the_content_wp_get_loading_attr_default()
  • data_wp_get_attachment_image_decoding_attr()
  • data_wp_get_loading_attr_default()
  • data_wp_get_loading_attr_default_before_and_no_loop()
  • data_wp_get_loading_optimization_attributes_arbitrary_contexts()
  • data_wp_get_loading_optimization_attributes_check_allowed_tags()
  • data_wp_get_loading_optimization_attributes_header_context()
  • data_wp_get_loading_optimization_attributes_min_required_attrs()
  • data_wp_lazy_loading_enabled_context_defaults()
  • data_wp_lazy_loading_enabled_tag_name_defaults()
  • data_wp_maybe_add_fetchpriority_high_attr()
  • data_wp_prepare_attachment_for_js_filesize()
  • data_wp_prepare_attachment_for_js_filesize_falls_back_to_the_file()
  • data_wp_prepare_attachment_for_js_unusable_full_size()
  • Made helper methods get_width_height_for_high_priority() and get_insufficient_width_height_for_high_priority() private static and called them via self::.

Why

PHPUnit 10+ requires data providers to be public static. Declaring them static prepares the test suite for modern PHPUnit versions without altering test behavior or assertion coverage.

Testing Instructions

Run the test suite and coding standards check:

vendor/bin/phpunit --filter Tests_Media
vendor/bin/phpunit -c tests/phpunit/multisite.xml --filter Tests_Media
vendor/bin/phpcs tests/phpunit/tests/media.php

All 564 tests (1578 assertions) pass cleanly.

@github-actions

github-actions Bot commented Nov 1, 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 devmuhib.

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.

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 media data-provider updates supporting PHPUnit 10+ compatibility.

No open issues 🎉

What changed in this PR

Updates the media test suite’s remaining data providers to prepare for PHPUnit 10+ requirements, supporting the migration tracked in Trac #66211.

Changes:

  • Declares 23 data providers as public static.
  • Converts two dimension helpers to private static and updates their callers to use self::.
  • Leaves test datasets and assertions unchanged.
File Description
tests/​phpunit/​tests/​media.php Makes data providers and supporting helpers static for modern PHPUnit compatibility.

Review effort: Balanced

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

Thanks! All 23 providers and both helpers are static, with no $this left in them. LGTM.

AI Review: Opus 5.5

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

Reviewed the changed code against the implementation and existing coverage; no blocking issue found.

Validated with the related provider/factory patches on current trunk: 1,108 tests and 2,503 assertions in each of single-site and multisite, randomized seed 1101. The same two environment-dependent skips occurred before and after; no failures or errors.

Current-head CI and Copilot review checked.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 1, 2026
Update post, database, view configuration, bookmark, admin, media, metadata, and variable test providers for newer PHPUnit versions. Use static calls for the media dimension helpers without changing datasets or assertions.

Developed in: #15270, #15308, #15309, #15310, #15311

Props shailu25, rejaulalomkhan, devmuhib, huzaifaalmesbah.
See #66211.


git-svn-id: https://develop.svn.wordpress.org/trunk@65162 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 1, 2026
Update post, database, view configuration, bookmark, admin, media, metadata, and variable test providers for newer PHPUnit versions. Use static calls for the media dimension helpers without changing datasets or assertions.

Developed in: WordPress/wordpress-develop#15270, WordPress/wordpress-develop#15308, WordPress/wordpress-develop#15309, WordPress/wordpress-develop#15310, WordPress/wordpress-develop#15311

Props shailu25, rejaulalomkhan, devmuhib, huzaifaalmesbah.
See #66211.

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


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

4 participants