-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
feature/assertionIssues related to assertions and expectationsIssues related to assertions and expectationstype/enhancementA new idea that should be implementedA new idea that should be implemented
Description
ICU 72.1 replaced an ASCII space with a Unicode Narrow-Non-Breaking-Space.
In our codebase we have some code which works with \DateTime to produce dates in various formats and we confirm that the output is correct.
With the changes in ICU 72.1 out tests break because the visually identical space is different.
It would not be correct to update the string in the test because it is dependent upon the version of ICU installed on the test system.
PHPUnit already has assertions for things like assertEqualsIgnorningCase
, assertStringContainsStringIgnoringCase
, and assertEqualsCanonicalizing
.
I wonder whether there is some merit in creatinng an assertion for assertEqualsIgnoringWhitespace
which would essentially add:
if ($ignoreCase) {
$expectedToCompare = strtolower($expectedToCompare);
$actualToCompare = strtolower($actualToCompare);
}
if ($ignoreWhitespace) {
$expectedToCompare = preg_replace('/\s/u', ' ', $expectedToCompare);
$actualToCompare = preg_replace('/\s/u', ' ', $actualToCompare);
}
Metadata
Metadata
Assignees
Labels
feature/assertionIssues related to assertions and expectationsIssues related to assertions and expectationstype/enhancementA new idea that should be implementedA new idea that should be implemented