Fix tests

This commit is contained in:
Roland Franssen 2019-05-29 12:13:42 +02:00
parent dd3dc1a684
commit 733f017904
2 changed files with 34 additions and 1 deletions

View File

@ -122,6 +122,17 @@ class TimezoneTypeTest extends BaseTypeTest
*/
public function testIntlTimeZoneInputWithBc()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone']);
$form->submit('Europe/Saratov');
@ -134,6 +145,17 @@ class TimezoneTypeTest extends BaseTypeTest
*/
public function testIntlTimeZoneInputWithBcAndIntl()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone', 'intl' => true]);
$form->submit('Europe/Saratov');

View File

@ -76,7 +76,7 @@ class TimezoneValidatorTest extends ConstraintValidatorTestCase
yield ['PST8PDT'];
yield ['America/Montreal'];
// expired in ICU
// previously expired in ICU
yield ['Europe/Saratov'];
// standard
@ -316,6 +316,17 @@ class TimezoneValidatorTest extends ConstraintValidatorTestCase
*/
public function testIntlCompatibility()
{
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches);
$tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0;
if (!$tzDbVersion || 2017 <= $tzDbVersion) {
$this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion);
}
$constraint = new Timezone([
'message' => 'myMessage',
'intlCompatible' => true,