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.
This commit is contained in:
commit
477ddfb44d
@ -67,7 +67,7 @@ class StubLocaleTest extends LocaleTestCase
|
|||||||
|
|
||||||
public function testGetCurrenciesData()
|
public function testGetCurrenciesData()
|
||||||
{
|
{
|
||||||
$symbol = $this->isGreaterOrEqualThanIcuVersion('4.8') ? 'BR$' : 'R$';
|
$symbol = $this->isSameAsIcuVersion('4.8') ? 'BR$' : 'R$';
|
||||||
|
|
||||||
$currencies = StubLocale::getCurrenciesData('en');
|
$currencies = StubLocale::getCurrenciesData('en');
|
||||||
$this->assertEquals($symbol, $currencies['BRL']['symbol']);
|
$this->assertEquals($symbol, $currencies['BRL']['symbol']);
|
||||||
|
Reference in New Issue
Block a user