Skip to content

Commit b226a77

Browse files
Fix tests
1 parent 831e0ca commit b226a77

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Validator\Constraint;
1616
use Symfony\Component\Validator\ConstraintValidator;
17+
use Symfony\Component\Validator\Tests\Fixtures\TestEnum;
1718

1819
class ConstraintValidatorTest extends TestCase
1920
{
@@ -41,14 +42,17 @@ public static function formatValueProvider()
4142
['array', []],
4243
['object', $toString = new TestToStringObject()],
4344
['ccc', $toString, ConstraintValidator::OBJECT_TO_STRING],
44-
['FirstCase', $toString = TestEnum::FirstCase],
4545
['object', $dateTime = new \DateTimeImmutable('1971-02-02T08:00:00UTC')],
4646
[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],
4747
[class_exists(\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM' : '1971-02-02 08:00:00', $dateTime, ConstraintValidator::PRETTY_DATE],
4848
[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],
4949
[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],
5050
];
5151

52+
if (\PHP_VERSION_ID >= 80100) {
53+
$data[] = ['FirstCase', TestEnum::FirstCase];
54+
}
55+
5256
date_default_timezone_set($defaultTimezone);
5357

5458
return $data;
@@ -74,9 +78,3 @@ public function __toString()
7478
return 'ccc';
7579
}
7680
}
77-
78-
enum TestEnum
79-
{
80-
case FirstCase;
81-
case SecondCase;
82-
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Tests\Fixtures;
13+
14+
enum TestEnum
15+
{
16+
case FirstCase;
17+
case SecondCase;
18+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy