Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 477ddfb

Browse files
committed
merged branch jakzal/stub-tests (PR #6515)
This PR was merged into the 2.1 branch. Commits ------- ef6f241 [Locale] Fixed the StubLocaleTest for ICU versions lower than 4.8. Discussion ---------- [Locale] Fixed the StubLocaleTest for ICU versions lower than 4.8 Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: no but for other reason in an another component Fixes the following tickets: #5517 Todo: - License of the code: MIT Documentation PR: - Symbol for Brazilian Real is BR$ only in ICU 4.8. All previous and later versions use R$. Links to the relevant data files: * http://source.icu-project.org/repos/icu/icu/tags/release-4-8/source/data/curr/en.txt * http://source.icu-project.org/repos/icu/icu/tags/release-4-4/source/data/curr/en.txt * http://source.icu-project.org/repos/icu/icu/tags/release-49-1/source/data/curr/en.txt --------------------------------------------------------------------------- by jakzal at 2012-12-29T19:23:25Z Note that currently *USE_ICU_DATA_VERSION* is required for some tests to pass. This is inconsistent with *Locale::getIcuDataVersion()* which returns *Locale::ICU_DATA_VERSION* if *USE_ICU_DATA_VERSION* is not set. Technically intl extension shouldn't be needed to run the stub tests. Following code could fix the issue for StubLocale tests: ```php class StubLocaleTest extends LocaleTestCase { // ... protected function getIntlExtensionIcuVersion() { // Locale::getIcuDataVersion(), which is used to determine the directory of stubs, // uses Locale::ICU_DATA_VERSION if USE_INTL_ICU_DATA_VERSION is not given if (!getenv('USE_INTL_ICU_DATA_VERSION')) { return Locale::ICU_DATA_VERSION; } return parent::getIntlExtensionIcuVersion(); } } ``` This code cannot be placed in the LocaleTestCase as intl tests need the icu data version from the intl extension. I'm not sure if this is desired and therefore I didn't include it in my PR. Let me know your thoughts and wether I should create another PR for this, use the current PR or forget about it.
2 parents f4f2ba8 + ef6f241 commit 477ddfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testGetCurrenciesDataWithUnsupportedLocale()
6767

6868
public function testGetCurrenciesData()
6969
{
70-
$symbol = $this->isGreaterOrEqualThanIcuVersion('4.8') ? 'BR$' : 'R$';
70+
$symbol = $this->isSameAsIcuVersion('4.8') ? 'BR$' : 'R$';
7171

7272
$currencies = StubLocale::getCurrenciesData('en');
7373
$this->assertEquals($symbol, $currencies['BRL']['symbol']);

0 commit comments

Comments
 (0)