Skip to content

Commit e2c11cb

Browse files
committed
[Intl] Added a check for the ICU data version to IntlTestHelper to prevent the stub class tests from failing
1 parent 427d24a commit e2c11cb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Symfony/Component/Intl/Util/IntlTestHelper.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public static function requireIntl(\PhpUnit_Framework_TestCase $testCase)
4343
$testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
4444
}
4545

46+
if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
47+
$testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
48+
}
49+
4650
// Normalize the default locale in case this is not done explicitly
4751
// in the test
4852
\Locale::setDefault('en');
@@ -70,11 +74,16 @@ public static function requireFullIntl(\PhpUnit_Framework_TestCase $testCase)
7074
$testCase->markTestSkipped('The intl extension is not available.');
7175
}
7276

73-
// ... and only if the version is *one specific version*.
77+
// ... and only if the version is *one specific version* ...
7478
if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
7579
$testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
7680
}
7781

82+
// ... and only if the data in the Icu component matches that version.
83+
if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
84+
$testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
85+
}
86+
7887
// Normalize the default locale in case this is not done explicitly
7988
// in the test
8089
\Locale::setDefault('en');

0 commit comments

Comments
 (0)