[Intl] Added a check for the ICU data version to IntlTestHelper to prevent the stub class tests from failing

This commit is contained in:
Bernhard Schussek 2013-04-04 19:03:19 +02:00
parent 427d24a7a7
commit e2c11cb81a
1 changed files with 10 additions and 1 deletions

View File

@ -43,6 +43,10 @@ class IntlTestHelper
$testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
}
if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
$testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
}
// Normalize the default locale in case this is not done explicitly
// in the test
\Locale::setDefault('en');
@ -70,11 +74,16 @@ class IntlTestHelper
$testCase->markTestSkipped('The intl extension is not available.');
}
// ... and only if the version is *one specific version*.
// ... and only if the version is *one specific version* ...
if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
$testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
}
// ... and only if the data in the Icu component matches that version.
if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
$testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
}
// Normalize the default locale in case this is not done explicitly
// in the test
\Locale::setDefault('en');