merged branch istaveren/ticket_5288 (PR #6109)

This PR was merged into the master branch.

Commits
-------

12a890f Issue 5288 fix

Discussion
----------

Issue #5288 fix

I only have the test failing on

php -v
5.4.6-1ubuntu1

ICU version 4.8.1.1

Test results

1) Symfony\Component\Locale\Tests\Stub\StubLocaleTest::testGetCurrenciesData
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -'BR$'
    +'R$'

It looks like the check $this->isSameAsIcuVersion('4.8') on line is to strict.
It was added here https://github.com/symfony/symfony/commit/90d6dc37 but I don't how to test the fix on icu version 4.8.0.x

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5288
Todo: Check older version of the ICU lib are still working. Because I could not test that.
This commit is contained in:
Fabien Potencier 2012-12-12 17:59:16 +01:00
commit acc10a1518
2 changed files with 11 additions and 2 deletions

View File

@ -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'),

View File

@ -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()