-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNT Fix test that didn't account for i18n spaces #611
MNT Fix test that didn't account for i18n spaces #611
Conversation
lint failure is unrelated and will be fixed by #610 |
@@ -1434,8 +1434,8 @@ public function testDBFieldArgs() | |||
$node = $result['data']['readOneDataObjectFake'] ?? null; | |||
$this->assertEquals('This is a varchar field', $node['myField']); | |||
$this->assertEquals('Saturday', $node['date1']); | |||
$this->assertEquals('2/29/20, 5:00 PM', $node['date2']); | |||
$this->assertEquals('5:00:00 PM', $node['date3']); | |||
$this->assertMatchesRegularExpression('#2/29/20,\h5:00\hPM#u', $node['date2']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it might be html5 overriding it - https://github.com/silverstripe/silverstripe-framework/blob/5/src/Forms/DateField.php#L450
However there's a comment that this should force a particular standard of date formats, so even then we still shouldn't get thin spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is draft for a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on php/php-src#11600 it seems that there was an intentional change in "ICU" which seems to be what's used under-the-hood for the i18n date formatting. This change includes the narrow non-breaking spaces which seem like they're here to stay.
We'll need to update a bunch of tests to account for it, including this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting failure
|
Fixes https://github.com/silverstripe/silverstripe-graphql/actions/runs/11061549418/job/30734504257?pr=610
The date formatter used is
IntlDateFormatter
which sometimes uses narrow non-breaking spaces. These are valid, given the intention of usingIntlDateFormatter
is to give a format that is correct for the locale used on the front-end, and in some locales the narrow non-breaking space is correct.This test doesn't have to care what specific spaces are used - just that the correct date is there in the correct format.
Issue