Skip to content

Commit 854a592

Browse files
Merge branch '6.4' into 7.3
* 6.4: [Validator] Skip tests using unavailable timezone on the local host [Yaml] Fix scope resolution operator in flow mapping keys
2 parents 22a97c4 + d6c3651 commit 854a592

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public function testNormalizeUsingFormatPassedInConstructor()
5454

5555
public function testNormalizeUsingTimeZonePassedInConstructor()
5656
{
57-
$normalizer = new DateTimeNormalizer([DateTimeNormalizer::TIMEZONE_KEY => new \DateTimeZone('Japan')]);
57+
$normalizer = new DateTimeNormalizer([DateTimeNormalizer::TIMEZONE_KEY => new \DateTimeZone('Asia/Tokyo')]);
5858

59-
$this->assertSame('2016-12-01T00:00:00+09:00', $normalizer->normalize(new \DateTimeImmutable('2016/12/01', new \DateTimeZone('Japan'))));
59+
$this->assertSame('2016-12-01T00:00:00+09:00', $normalizer->normalize(new \DateTimeImmutable('2016/12/01', new \DateTimeZone('Asia/Tokyo'))));
6060
$this->assertSame('2016-12-01T09:00:00+09:00', $normalizer->normalize(new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC'))));
6161
}
6262

@@ -73,9 +73,9 @@ public function testNormalizeUsingTimeZonePassedInContext($expected, $input, $ti
7373
public static function normalizeUsingTimeZonePassedInContextProvider()
7474
{
7575
yield ['2016-12-01T00:00:00+00:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC')), null];
76-
yield ['2016-12-01T00:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('Japan')), new \DateTimeZone('Japan')];
77-
yield ['2016-12-01T09:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')];
78-
yield ['2016-12-01T09:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')];
76+
yield ['2016-12-01T00:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('Asia/Tokyo')), new \DateTimeZone('Asia/Tokyo')];
77+
yield ['2016-12-01T09:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Asia/Tokyo')];
78+
yield ['2016-12-01T09:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Asia/Tokyo')];
7979
}
8080

8181
/**
@@ -139,7 +139,7 @@ public static function normalizeUsingTimeZonePassedInContextAndExpectedFormatWit
139139
'2018-12-01T18:03:06.067634',
140140
new \DateTimeZone('UTC')
141141
),
142-
new \DateTimeZone('Europe/Kiev'),
142+
new \DateTimeZone('Europe/Kyiv'),
143143
];
144144

145145
yield [
@@ -253,7 +253,7 @@ public function testDenormalize()
253253

254254
public function testDenormalizeUsingTimezonePassedInConstructor()
255255
{
256-
$timezone = new \DateTimeZone('Japan');
256+
$timezone = new \DateTimeZone('Asia/Tokyo');
257257
$expected = new \DateTimeImmutable('2016/12/01 17:35:00', $timezone);
258258
$normalizer = new DateTimeNormalizer([DateTimeNormalizer::TIMEZONE_KEY => $timezone]);
259259

@@ -286,18 +286,18 @@ public static function denormalizeUsingTimezonePassedInContextProvider()
286286
{
287287
yield 'with timezone' => [
288288
'2016/12/01 17:35:00',
289-
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')),
290-
new \DateTimeZone('Japan'),
289+
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Asia/Tokyo')),
290+
new \DateTimeZone('Asia/Tokyo'),
291291
];
292292
yield 'with timezone as string' => [
293293
'2016/12/01 17:35:00',
294-
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')),
295-
'Japan',
294+
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Asia/Tokyo')),
295+
'Asia/Tokyo',
296296
];
297297
yield 'with format without timezone information' => [
298298
'2016.12.01 17:35:00',
299-
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')),
300-
new \DateTimeZone('Japan'),
299+
new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Asia/Tokyo')),
300+
new \DateTimeZone('Asia/Tokyo'),
301301
'Y.m.d H:i:s',
302302
];
303303
yield 'ignored with format with timezone information' => [

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ public function testGroupedTimezonesWithInvalidCountry()
270270
*/
271271
public function testDeprecatedTimezonesAreValidWithBC(string $timezone)
272272
{
273+
// Skip test if the timezone is not available in the current timezone database
274+
if (!\in_array($timezone, \DateTimeZone::listIdentifiers(\DateTimeZone::ALL_WITH_BC), true)) {
275+
$this->markTestSkipped(sprintf('Timezone "%s" is not available in the current timezone database', $timezone));
276+
}
277+
273278
$constraint = new Timezone(\DateTimeZone::ALL_WITH_BC);
274279

275280
$this->validator->validate($timezone, $constraint);

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
459459
}
460460

461461
if ('!php/const' === $key || '!php/enum' === $key) {
462-
$key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false);
462+
$key .= ' '.self::parseScalar($mapping, $flags, ['(?<!:):(?!:)'], $i, false);
463463
$key = self::evaluateScalar($key, $flags);
464464
}
465465

src/Symfony/Component/Yaml/Tests/InlineTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static function getTestsForParsePhpConstants()
6363
['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
6464
['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
6565
['!php/const NULL', null],
66+
['{ !php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT: foo }', [Yaml::PARSE_CONSTANT => 'foo']],
6667
];
6768
}
6869

0 commit comments

Comments
 (0)