Skip to content

Tests: Ensure block support tests are resilient to equivalent HTML changes - #72934

Closed
sirreal wants to merge 10 commits into
trunkfrom
fix/php-tests-html-with-expect-html
Closed

sirreal wants to merge 10 commits into
trunkfrom
fix/php-tests-html-with-expect-html

Conversation

@sirreal

@sirreal sirreal commented Nov 3, 2025 •

Copy link
Copy Markdown
Member

What?

Follow-up to #72236.

Updates background block support PHP tests to compare generated wrapper markup with assertEqualHTML() instead of byte-for-byte string equality. Also enables the PHP unit test workflow to run against the previous major WordPress version on PRs.

Why?

Equivalent HTML can serialize with different character references across WordPress versions, for example ' vs '. These differences should not fail tests when the resulting HTML is semantically equivalent.

How?

  • Replaces assertEquals() with assertEqualHTML() for HTML semantic equality comparison instead of string equality.

Testing Instructions

CI workflow should be sufficient. This is a testing change.

Use of AI Tools

OpenAI Codex was used to help rebase the branch, resolve conflicts, run local checks, and draft this PR description. The original changes were authored without the use of AI.

@sirreal sirreal added the [Type] Flaky Test Auto-generated flaky test report issue label Nov 3, 2025
@sirreal sirreal self-assigned this Nov 3, 2025
@sirreal sirreal added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Nov 3, 2025
@github-actions

github-actions Bot commented Nov 3, 2025 •

Copy link
Copy Markdown

Flaky tests detected in 95c87ef.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27605304690
📝 Reported issues:

@sirreal
sirreal requested review from ntsekouras and talldan November 3, 2025 17:38
@sirreal
sirreal marked this pull request as ready for review November 3, 2025 17:38
@github-actions

github-actions Bot commented Nov 3, 2025 •

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. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread phpunit/block-supports/background-test.php Outdated
@sirreal
sirreal force-pushed the fix/php-tests-html-with-expect-html branch from 3d624fb to 558893d Compare November 3, 2025 17:42
@ntsekouras

Copy link
Copy Markdown
Contributor

Thanks for the PR! I thought we had tried that before when investigating and the CI didn't pass. Wasn't that the case?

CI passes.

The difference between now and back then is that the previous failures were from PHP previous major version, which as of #72506 they are not run on GB PR before merged. Have you tested those jobs somehow?

@sirreal
sirreal requested a review from desrosj as a code owner November 4, 2025 11:09
@sirreal

sirreal commented Nov 4, 2025

Copy link
Copy Markdown
Member Author

The difference between now and back then is that the previous failures were from PHP previous major version, which as of #72506 they are not run on GB PR before merged. Have you tested those jobs somehow?

Thank you for noticing that! Indeed, the test method was unavailable in the previous version and we see an error:

Error: Call to undefined method WP_Block_Supports_Background_Test::assertEqualHTML()

This change would be good to make but unfortunately we'll have to wait 🙂

@sirreal
sirreal marked this pull request as draft November 4, 2025 11:50
@sirreal
sirreal removed the request for review from desrosj November 4, 2025 11:51
@github-actions github-actions Bot added the Stale label Nov 20, 2025
@github-actions github-actions Bot closed this Nov 22, 2025
@sirreal sirreal reopened this Jun 15, 2026
@sirreal
sirreal force-pushed the fix/php-tests-html-with-expect-html branch 3 times, most recently from 98ddfe2 to 8072dec Compare June 15, 2026 19:50
@sirreal
sirreal marked this pull request as ready for review June 15, 2026 19:51
@sirreal

sirreal commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

assertEqualHTML should be available now and can be used. It's been available since 6.9.

@github-actions github-actions Bot removed the Stale label Jun 16, 2026
@sirreal
sirreal force-pushed the fix/php-tests-html-with-expect-html branch from 8072dec to 95c87ef Compare June 16, 2026 08:40
@github-actions github-actions Bot added the Stale label Jul 2, 2026
@github-actions github-actions Bot closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core Stale [Type] Flaky Test Auto-generated flaky test report issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants