From 12a890f7cb5fb4979956f38cf6e8fd2cbfc5d083 Mon Sep 17 00:00:00 2001 From: Iwan van Staveren Date: Sat, 24 Nov 2012 15:35:35 +0100 Subject: [PATCH] Issue 5288 fix --- .../Locale/Tests/Stub/StubNumberFormatterTest.php | 2 +- src/Symfony/Component/Locale/Tests/TestCase.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php b/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php index 9471f820d1..7f033a31a9 100644 --- a/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php +++ b/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php @@ -210,7 +210,7 @@ class StubNumberFormatterTest extends LocaleTestCase public function formatCurrencyWithCurrencyStyleBrazilianRealRoundingProvider() { - $brl = $this->isIntlExtensionLoaded() && $this->isSameAsIcuVersion('4.8') ? 'BR' : 'R'; + $brl = $this->isIntlExtensionLoaded() && $this->isGreaterOrEqualThanIcuVersion('4.8') ? 'BR' : 'R'; return array( array(100, 'BRL', $brl, '%s$100.00'), diff --git a/src/Symfony/Component/Locale/Tests/TestCase.php b/src/Symfony/Component/Locale/Tests/TestCase.php index b6483285a2..1cc2e9fcfb 100644 --- a/src/Symfony/Component/Locale/Tests/TestCase.php +++ b/src/Symfony/Component/Locale/Tests/TestCase.php @@ -89,7 +89,16 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase protected function normalizeIcuVersion($version) { - return ((float) $version) * 100; + $versionIds = explode(".", $version); + + $multi = 1000; + $intVersion = 0; + foreach ($versionIds as $id) { + $intVersion += $id * $multi; + $multi = $multi/10; + } + + return (int) $intVersion; } protected function getIntlExtensionIcuVersion()