Skip to content

Commit e95605c

Browse files
committed
minor symfony#52740 [Validator] Made tests forward-compatible with ICU 72.1 (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- [Validator] Made tests forward-compatible with ICU 72.1 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT Starting with ICU 72.1 (CLDR 42), the INTL extension renders a so-called narrow non-breaking space into various localized date and time formats. Our CI does not catch that change yet because it runs an older version of the ICU library. I'm running PHP on a Mac with Homebrew as package manager which already ships a newer ICU (73.2 currently). This causes a lot of validator tests to fail because they expect a space in time expressions like `12:00 AM` where a NNBSP character is rendered instead. This change is an attempt to give me a green test suite while maintaining the ability to run against older ICU versions, such as the one our CI uses. Commits ------- 0ee9933 [Validator] Made tests forward-compatible with ICU 72.1
2 parents 80b5ce4 + 0ee9933 commit e95605c

11 files changed

+135
-81
lines changed

src/Symfony/Component/Validator/Tests/ConstraintValidatorTest.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@
1818

1919
class ConstraintValidatorTest extends TestCase
2020
{
21+
use IcuCompatibilityTrait;
22+
2123
/**
2224
* @dataProvider formatValueProvider
2325
*/
24-
public function testFormatValue($expected, $value, $format = 0)
26+
public function testFormatValue(string $expected, $value, int $format = 0)
2527
{
2628
\Locale::setDefault('en');
2729

2830
$this->assertSame($expected, (new TestFormatValueConstraintValidator())->formatValueProxy($value, $format));
2931
}
3032

31-
public static function formatValueProvider()
33+
public static function formatValueProvider(): array
3234
{
3335
$defaultTimezone = date_default_timezone_get();
3436
date_default_timezone_set('Europe/Moscow'); // GMT+3
@@ -43,10 +45,10 @@ public static function formatValueProvider()
4345
['object', $toString = new TestToStringObject()],
4446
['ccc', $toString, ConstraintValidator::OBJECT_TO_STRING],
4547
['object', $dateTime = new \DateTimeImmutable('1971-02-02T08:00:00UTC')],
46-
[class_exists(\IntlDateFormatter::class) ? 'Oct 4, 2019, 11:02 AM' : '2019-10-04 11:02:03', new \DateTimeImmutable('2019-10-04T11:02:03+09:00'), ConstraintValidator::PRETTY_DATE],
47-
[class_exists(\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM' : '1971-02-02 08:00:00', $dateTime, ConstraintValidator::PRETTY_DATE],
48-
[class_exists(\IntlDateFormatter::class) ? 'Jan 1, 1970, 6:00 AM' : '1970-01-01 06:00:00', new \DateTimeImmutable('1970-01-01T06:00:00Z'), ConstraintValidator::PRETTY_DATE],
49-
[class_exists(\IntlDateFormatter::class) ? 'Jan 1, 1970, 3:00 PM' : '1970-01-01 15:00:00', (new \DateTimeImmutable('1970-01-01T23:00:00'))->setTimezone(new \DateTimeZone('America/New_York')), ConstraintValidator::PRETTY_DATE],
48+
[class_exists(\IntlDateFormatter::class) ? static::normalizeIcuSpaces("Oct 4, 2019, 11:02\u{202F}AM") : '2019-10-04 11:02:03', new \DateTimeImmutable('2019-10-04T11:02:03+09:00'), ConstraintValidator::PRETTY_DATE],
49+
[class_exists(\IntlDateFormatter::class) ? static::normalizeIcuSpaces("Feb 2, 1971, 8:00\u{202F}AM") : '1971-02-02 08:00:00', $dateTime, ConstraintValidator::PRETTY_DATE],
50+
[class_exists(\IntlDateFormatter::class) ? static::normalizeIcuSpaces("Jan 1, 1970, 6:00\u{202F}AM") : '1970-01-01 06:00:00', new \DateTimeImmutable('1970-01-01T06:00:00Z'), ConstraintValidator::PRETTY_DATE],
51+
[class_exists(\IntlDateFormatter::class) ? static::normalizeIcuSpaces("Jan 1, 1970, 3:00\u{202F}PM") : '1970-01-01 15:00:00', (new \DateTimeImmutable('1970-01-01T23:00:00'))->setTimezone(new \DateTimeZone('America/New_York')), ConstraintValidator::PRETTY_DATE],
5052
];
5153

5254
if (\PHP_VERSION_ID >= 80100) {
@@ -61,11 +63,11 @@ public static function formatValueProvider()
6163

6264
final class TestFormatValueConstraintValidator extends ConstraintValidator
6365
{
64-
public function validate($value, Constraint $constraint)
66+
public function validate($value, Constraint $constraint): void
6567
{
6668
}
6769

68-
public function formatValueProxy($value, $format)
70+
public function formatValueProxy($value, int $format): string
6971
{
7072
return $this->formatValue($value, $format);
7173
}

src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\EqualTo;
1616
use Symfony\Component\Validator\Constraints\EqualToValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class EqualToValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new EqualToValidator();
@@ -70,14 +73,14 @@ public static function provideInvalidComparisons(): array
7073
return [
7174
[1, '1', 2, '2', 'int'],
7275
['22', '"22"', '333', '"333"', 'string'],
73-
[new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
74-
[new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
75-
[new \DateTime('2001-01-01 UTC'), 'Jan 1, 2001, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
76+
[new \DateTime('2001-01-01'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
77+
[new \DateTime('2001-01-01'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), '2000-01-01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
78+
[new \DateTime('2001-01-01 UTC'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), '2000-01-01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
7679
[new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
7780
];
7881
}
7982

80-
public static function provideComparisonsToNullValueAtPropertyPath()
83+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8184
{
8285
return [
8386
[5, '5', false],

src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
1616
use Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class GreaterThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new GreaterThanOrEqualValidator();
@@ -73,14 +76,14 @@ public static function provideInvalidComparisons(): array
7376
{
7477
return [
7578
[1, '1', 2, '2', 'int'],
76-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'],
77-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'],
78-
[new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'],
79+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), new \DateTime('2005/01/01'), self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
80+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2005/01/01', self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
81+
[new \DateTime('2000/01/01 UTC'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2005/01/01 UTC', self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
7982
['b', '"b"', 'c', '"c"', 'string'],
8083
];
8184
}
8285

83-
public static function provideComparisonsToNullValueAtPropertyPath()
86+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8487
{
8588
return [
8689
[5, '5', true],

src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\GreaterThan;
1616
use Symfony\Component\Validator\Constraints\GreaterThanValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class GreaterThanValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new GreaterThanValidator();
@@ -69,20 +72,20 @@ public static function provideInvalidComparisons(): array
6972
return [
7073
[1, '1', 2, '2', 'int'],
7174
[2, '2', 2, '2', 'int'],
72-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'],
73-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
74-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'],
75-
[new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
76-
[new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'],
77-
[new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
75+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), new \DateTime('2005/01/01'), self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
76+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
77+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2005/01/01', self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
78+
[new \DateTime('2000/01/01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000/01/01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
79+
[new \DateTime('2000/01/01 UTC'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2005/01/01 UTC', self::normalizeIcuSpaces("Jan 1, 2005, 12:00\u{202F}AM"), 'DateTime'],
80+
[new \DateTime('2000/01/01 UTC'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000/01/01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
7881
[new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
7982
[new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
8083
['22', '"22"', '333', '"333"', 'string'],
8184
['22', '"22"', '22', '"22"', 'string'],
8285
];
8386
}
8487

85-
public static function provideComparisonsToNullValueAtPropertyPath()
88+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8689
{
8790
return [
8891
[5, '5', true],

src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\IdenticalTo;
1616
use Symfony\Component\Validator\Constraints\IdenticalToValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new IdenticalToValidator();
@@ -90,13 +93,13 @@ public static function provideInvalidComparisons(): array
9093
[1, '1', 2, '2', 'int'],
9194
[2, '2', '2', '"2"', 'string'],
9295
['22', '"22"', '333', '"333"', 'string'],
93-
[new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'],
94-
[new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'],
96+
[new \DateTime('2001-01-01'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), new \DateTime('2001-01-01'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), 'DateTime'],
97+
[new \DateTime('2001-01-01'), self::normalizeIcuSpaces("Jan 1, 2001, 12:00\u{202F}AM"), new \DateTime('1999-01-01'), self::normalizeIcuSpaces("Jan 1, 1999, 12:00\u{202F}AM"), 'DateTime'],
9598
[new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
9699
];
97100
}
98101

99-
public static function provideComparisonsToNullValueAtPropertyPath()
102+
public static function provideComparisonsToNullValueAtPropertyPath(): array
100103
{
101104
return [
102105
[5, '5', false],

src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
1616
use Symfony\Component\Validator\Constraints\LessThanOrEqualValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class LessThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new LessThanOrEqualValidator();
@@ -75,15 +78,15 @@ public static function provideInvalidComparisons(): array
7578
{
7679
return [
7780
[2, '2', 1, '1', 'int'],
78-
[new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
79-
[new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
80-
[new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
81+
[new \DateTime('2010-01-01'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
82+
[new \DateTime('2010-01-01'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), '2000-01-01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
83+
[new \DateTime('2010-01-01 UTC'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), '2000-01-01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
8184
[new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'],
8285
['c', '"c"', 'b', '"b"', 'string'],
8386
];
8487
}
8588

86-
public static function provideComparisonsToNullValueAtPropertyPath()
89+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8790
{
8891
return [
8992
[5, '5', true],

src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\LessThan;
1616
use Symfony\Component\Validator\Constraints\LessThanValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class LessThanValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new LessThanValidator();
@@ -69,19 +72,19 @@ public static function provideInvalidComparisons(): array
6972
return [
7073
[3, '3', 2, '2', 'int'],
7174
[2, '2', 2, '2', 'int'],
72-
[new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
73-
[new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
74-
[new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
75-
[new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
76-
[new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
77-
[new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
75+
[new \DateTime('2010-01-01'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
76+
[new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
77+
[new \DateTime('2010-01-01'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), '2000-01-01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
78+
[new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000-01-01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
79+
[new \DateTime('2010-01-01 UTC'), self::normalizeIcuSpaces("Jan 1, 2010, 12:00\u{202F}AM"), '2000-01-01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
80+
[new \DateTime('2000-01-01 UTC'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000-01-01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
7881
[new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
7982
[new ComparisonTest_Class(6), '6', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
8083
['333', '"333"', '22', '"22"', 'string'],
8184
];
8285
}
8386

84-
public static function provideComparisonsToNullValueAtPropertyPath()
87+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8588
{
8689
return [
8790
[5, '5', true],

src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\NotEqualTo;
1616
use Symfony\Component\Validator\Constraints\NotEqualToValidator;
17+
use Symfony\Component\Validator\Tests\IcuCompatibilityTrait;
1718

1819
/**
1920
* @author Daniel Holmes <daniel@danielholmes.org>
2021
*/
2122
class NotEqualToValidatorTest extends AbstractComparisonValidatorTestCase
2223
{
24+
use IcuCompatibilityTrait;
25+
2326
protected function createValidator()
2427
{
2528
return new NotEqualToValidator();
@@ -70,14 +73,14 @@ public static function provideInvalidComparisons(): array
7073
[3, '3', 3, '3', 'int'],
7174
['2', '"2"', 2, '2', 'int'],
7275
['a', '"a"', 'a', '"a"', 'string'],
73-
[new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'],
74-
[new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
75-
[new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'],
76+
[new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
77+
[new \DateTime('2000-01-01'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000-01-01', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
78+
[new \DateTime('2000-01-01 UTC'), self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), '2000-01-01 UTC', self::normalizeIcuSpaces("Jan 1, 2000, 12:00\u{202F}AM"), 'DateTime'],
7679
[new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'],
7780
];
7881
}
7982

80-
public static function provideComparisonsToNullValueAtPropertyPath()
83+
public static function provideComparisonsToNullValueAtPropertyPath(): array
8184
{
8285
return [
8386
[5, '5', true],

0 commit comments

Comments
 (0)