Skip to content

[13.x] Add tests for SeeInHtml constraint covering unicode whitespace#60128

Merged
taylorotwell merged 2 commits into
laravel:13.xfrom
scabarcas17:add/see-in-html-tests
May 14, 2026
Merged

[13.x] Add tests for SeeInHtml constraint covering unicode whitespace#60128
taylorotwell merged 2 commits into
laravel:13.xfrom
scabarcas17:add/see-in-html-tests

Conversation

@scabarcas17
Copy link
Copy Markdown
Contributor

Why

SeeInHtml::normalize() had no test coverage. PR #60090 added the /u modifier to preg_replace('/\s+/u', ' ', $value) so HTML containing Unicode
whitespace (non-breaking space, em space, ideographic space, etc.) collapses correctly before comparison — but the fix shipped without tests, so future
regressions wouldn't be caught.

What

Adds tests/Testing/SeeInHtmlTest.php with 6 test methods covering:

  • Unicode whitespace via HTML entities ( ,  ,  ).
  • Raw UTF-8 whitespace via a data provider (U+00A0, U+2002, U+2003, U+2009, U+3000).
  • ASCII whitespace collapsing (regression for the pre-/u behavior).
  • negate mode inverting the assertion correctly.
  • ordered mode respecting sequence across unicode whitespace.

Copilot AI review requested due to automatic review settings May 14, 2026 15:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds dedicated PHPUnit coverage for Illuminate\Testing\Constraints\SeeInHtml::normalize() to prevent regressions in Unicode whitespace collapsing (the /u regex modifier behavior introduced in #60090) when asserting rendered HTML/text.

Changes:

  • Introduces a new SeeInHtmlTest suite validating Unicode whitespace collapsing from both HTML entities and raw UTF-8 whitespace characters.
  • Adds regression coverage for ASCII whitespace collapsing, negate-mode behavior, and ordered matching across Unicode whitespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@taylorotwell taylorotwell merged commit 32ec0a0 into laravel:13.x May 14, 2026
52 checks passed
@scabarcas17 scabarcas17 deleted the add/see-in-html-tests branch May 14, 2026 20:00
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