From 33e70673c287e3fdd5ffb55c8e3e28638b7bb339 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Wed, 23 Feb 2011 14:38:05 +0100 Subject: [PATCH] [Locale] Fixed failing StubNumberFormatterTest when intl extension is not loaded --- .../Tests/Component/Locale/Stub/StubNumberFormatterTest.php | 6 +++++- tests/Symfony/Tests/Component/Locale/TestCase.php | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php b/tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php index d135aca746..3419a35c9f 100644 --- a/tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php +++ b/tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php @@ -188,11 +188,15 @@ class StubNumberFormatterTest extends LocaleTestCase public function formatCurrencyWithCurrencyStyleSwissRoundingProvider() { + $chf = 'CHF'; + // The currency symbol was updated from 4.2 to the 4.4 version. The ICU CLDR data was updated in 2010-03-03, // the 4.2 release is from 2009-05-08 and the 4.4 from 2010-03-17. It's ugly we want to compare if the // stub implementation is behaving like the intl one // http://bugs.icu-project.org/trac/changeset/27776/icu/trunk/source/data/curr/en.txt - $chf = $this->isLowerThanIcuVersion('4.4') ? 'Fr.' : 'CHF'; + if ($this->isIntlExtensionLoaded() && $this->isLowerThanIcuVersion('4.4')) { + $chf = 'Fr.'; + } return array( array(100, 'CHF', $chf, '%s100.00'), diff --git a/tests/Symfony/Tests/Component/Locale/TestCase.php b/tests/Symfony/Tests/Component/Locale/TestCase.php index 43d1c0920d..b9960ef7e0 100644 --- a/tests/Symfony/Tests/Component/Locale/TestCase.php +++ b/tests/Symfony/Tests/Component/Locale/TestCase.php @@ -78,6 +78,10 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase return self::$icuVersion; } + if (!$this->isIntlExtensionLoaded()) { + throw new \RuntimeException('The intl extension is not available'); + } + ob_start(); phpinfo(INFO_MODULES); $output = ob_get_clean();