Skip to content

Tests: Make data_wp_hoist_late_printed_styles data provider public and static - #15730

Closed
fozlerabbi48 wants to merge 1 commit into
WordPress:trunkfrom
fozlerabbi48:template-hoist-late-printed-styles
Closed

fozlerabbi48 wants to merge 1 commit into
WordPress:trunkfrom
fozlerabbi48:template-hoist-late-printed-styles

Conversation

@fozlerabbi48

Copy link
Copy Markdown

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

Description

Declares data_wp_hoist_late_printed_styles() in tests/phpunit/tests/template.php as public static for modern PHPUnit compatibility.
Converts the inline assertion closures in the datasets to static function and updates assertion calls from $this->assert... to self::assert....

Testing Instructions

  1. Run single site tests:
    npm run test:php -- --filter Tests_Template::test_wp_hoist_late_printed_styles
  2. Run multisite tests:
    npm run test:php -- --filter Tests_Template::test_wp_hoist_late_printed_styles -c tests/phpunit/multisite.xml

…d static.

Declares `data_wp_hoist_late_printed_styles()` in `tests/phpunit/tests/template.php` as `public static` for PHPUnit compatibility. Converts inner assertion closures to static and uses static assertion calls.

See #66211.
@github-actions

github-actions Bot commented Nov 6, 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 fozlerabbi48.

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

There are no active review issues for the PHPUnit compatibility update.

No open issues 🎉

What changed in this PR

Updates the late-printed-style test data provider for modern PHPUnit compatibility without changing test expectations.

Changes:

  • Makes data_wp_hoist_late_printed_styles() static while retaining public visibility.
  • Converts dataset assertion closures to static closures and replaces $this->assert... calls with self::assert....
File Description
tests/​phpunit/​tests/​template.php Updates the data provider and assertion closures to use static declarations and calls.

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.

Thanks @fozlerabbi48. This provider needed more than the static keyword, and you handled it well: a closure built in a static method has no $this, so self::assert*() is the right call.

I checked that the assertions inside the closures still run: when I broke one, the test failed. Tests_Template passes in single site and multisite, with the same test and assertion counts as trunk. #15442 covers the other two providers in this file.

I'll land this with other #66211 data providers in one commit, as described in https://core.trac.wordpress.org/ticket/66211#comment:109.

AI review · claude-opus-5-5

wporg-sync pushed a commit that referenced this pull request Nov 6, 2026
Update the template, theme, view configuration, Ajax time format and PHPUnit group filter test providers for newer PHPUnit versions. Two providers used `$this`: the late-printed styles provider now uses static closures with `self::assert*()`, and the default themes list is now a static property.

Developed in: #15730, #15731, #15732, #15733, #15734, #15442, #15438

Props fozlerabbi48, devmuhib.
See #66211.


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

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 6, 2026
Update the template, theme, view configuration, Ajax time format and PHPUnit group filter test providers for newer PHPUnit versions. Two providers used `$this`: the late-printed styles provider now uses static closures with `self::assert*()`, and the default themes list is now a static property.

Developed in: WordPress/wordpress-develop#15730, WordPress/wordpress-develop#15731, WordPress/wordpress-develop#15732, WordPress/wordpress-develop#15733, WordPress/wordpress-develop#15734, WordPress/wordpress-develop#15442, WordPress/wordpress-develop#15438

Props fozlerabbi48, devmuhib.
See #66211.

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


git-svn-id: http://core.svn.wordpress.org/trunk@64453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
arshidkv12 pushed a commit to arshidkv12/wordpress-develop that referenced this pull request Nov 21, 2026
Update the template, theme, view configuration, Ajax time format and PHPUnit group filter test providers for newer PHPUnit versions. Two providers used `$this`: the late-printed styles provider now uses static closures with `self::assert*()`, and the default themes list is now a static property.

Developed in: WordPress#15730, WordPress#15731, WordPress#15732, WordPress#15733, WordPress#15734, WordPress#15442, WordPress#15438

Props fozlerabbi48, devmuhib.
See #66211.


git-svn-id: https://develop.svn.wordpress.org/trunk@65313 602fd350-edb4-49c9-b593-d223f7449a82
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