[wp-trac] [WordPress Trac] #63527: Tests: Add test assertion to compare HTML for equivalence
WordPress Trac
noreply at wordpress.org
Tue Jun 10 10:23:54 UTC 2025
#63527: Tests: Add test assertion to compare HTML for equivalence
--------------------------------------+------------------------------
Reporter: Bernhard Reiter | Owner: Bernhard Reiter
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.9
Component: Build/Test Tools | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Changes (by Bernhard Reiter):
* owner: (none) => Bernhard Reiter
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"60295" 60295]:
{{{
#!CommitTicketReference repository="" revision="60295"
Tests: Add new `assertEqualHTML` assertion.
Add a new `assertEqualHTML` method to `WP_UnitTestClass` for tests
comparing HTML (potentially including block markup).
Internally, the assertion builds a deterministic tree string
representation of the markup (using the HTML API) and compares the
results. The format of the tree is inspired by the HTML5lib-tests tree
format. It is extended with a special representation of block delimiters
and their attributes. This format also makes it easier to visually spot
the differences between the two strings if the assertion fails.
Finally, this changeset updates `Tests_Dependencies_Scripts` to remove its
`assertEqualMarkup` and `parse_markup_fragment` methods, and to use the
newly introduced `assertEqualHTML` instead.
Props bernhard-reiter, jonsurrell, dmsnell, jorbin, gziolo.
Fixes #63527.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63527#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list