From e2c11cb81af3da232f4c822b1880069ca74dc1e2 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 4 Apr 2013 19:03:19 +0200 Subject: [PATCH] [Intl] Added a check for the ICU data version to IntlTestHelper to prevent the stub class tests from failing --- src/Symfony/Component/Intl/Util/IntlTestHelper.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index 47aaa72a1a..6b4bd096c7 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -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');