8000 minor #31685 Fix tests (ro0NL) · symfony/symfony@96ecf4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 96ecf4b

Browse files
minor #31685 Fix tests (ro0NL)
This PR was merged into the 4.3 branch. Discussion ---------- Fix tests | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #31638 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Commits ------- 733f017 Fix tests
2 parents e9f3a9d + 733f017 commit 96ecf4b

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ public function testIntlTimeZoneInput()
122122
*/
123123
public function testIntlTimeZoneInputWithBc()
124124
{
125+
$reflector = new \ReflectionExtension('intl');
126+
ob_start();
127+
$reflector->info();
128+
$output = strip_tags(ob_get_clean());
129+
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
130+
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
131+
132+
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
133+
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
134+
}
135+
125136
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone']);
126137
$form->submit('Europe/Saratov');
127138

@@ -134,6 +145,17 @@ public function testIntlTimeZoneInputWithBc()
134145
*/
135146
public function testIntlTimeZoneInputWithBcAndIntl()
136147
{
148+
$reflector = new \ReflectionExtension('intl');
149+
ob_start();
150+
$reflector->info();
151+
$output = strip_tags(ob_get_clean());
152+
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
153+
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
154+
155+
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
156+
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
157+
}
158+
137159
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone', 'intl' => true]);
138160
$form->submit('Europe/Saratov');
139161

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getValidTimezones(): iterable
7676
yield ['PST8PDT'];
7777
yield ['America/Montreal'];
7878

79-
// expired in ICU
79+
// previously expired in ICU
8080
yield ['Europe/Saratov'];
8181

8282
// standard
@@ -316,6 +316,17 @@ public function getDeprecatedTimezones(): iterable
316316
*/
317317
public function testIntlCompatibility()
318318
{
319+
$reflector = new \ReflectionExtension('intl');
320+
ob_start();
321+
$reflector->info();
322+
$output = strip_tags(ob_get_clean());
323+
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
324+
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
325+
326+
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
327+
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
328+
}
329+
319330
$constraint = new Timezone([
320331
'message' => 'myMessage',
321332
'intlCompatible' => true,

0 commit comments

Comments
 (0)
0