Skip to content

Add CharacterReferenceEquivalenceTest#2

Merged
juanmaguitar merged 2 commits intomainfrom
add/character-reference-equivalence-test
Feb 23, 2026
Merged

Add CharacterReferenceEquivalenceTest#2
juanmaguitar merged 2 commits intomainfrom
add/character-reference-equivalence-test

Conversation

@juanmaguitar
Copy link
Copy Markdown
Contributor

Summary

  • Adds CharacterReferenceEquivalenceTest to demonstrate that assertEqualHTML() normalises all representations of an HTML character before comparing
  • Covers literal UTF-8, named (¬), decimal (¬), padded decimal (¬), hex (¬), padded hex (¬), and named without semicolon (&not)
  • Includes a skipped assertSame counterpart showing why the simpler assertion fails for this case, following the pattern established in LazyLoadImagesTest

Context

Prompted by a reviewer suggestion on the companion article draft: any given character has 3–4 base representations and theoretically infinite actual representations, making this a strong showcase for assertEqualHTML()'s normalisation capabilities.

Test plan

  • npm run test:php passes with the new test included
  • Removing markTestSkipped() from test_assertsame_fails_for_character_references causes that test to fail as expected

🤖 Generated with Claude Code

juanmaguitar and others added 2 commits February 23, 2026 16:59
Demonstrates that assertEqualHTML normalises all representations of an
HTML character (literal, named, decimal, padded decimal, hex, padded hex,
and named without semicolon) to the same value before comparing, so tests
pass regardless of which encoding is used. Includes a skipped assertSame
counterpart that shows why the simpler assertion cannot handle this.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@juanmaguitar juanmaguitar merged commit 70fcae4 into main Feb 23, 2026
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.

1 participant