Skip to content

[Locale] Stub test failures #5288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmikola opened this issue Aug 17, 2012 · 9 comments · Fixed by #6568
Closed

[Locale] Stub test failures #5288

jmikola opened this issue Aug 17, 2012 · 9 comments · Fixed by #6568
Labels

Comments

@jmikola
Copy link
Contributor

jmikola commented Aug 17, 2012

I ran the master branch's test suite and noticed a few errors that I wanted to share.

PHP version:

$ php -v
PHP 5.4.4-4~precise+1 (cli) (built: Aug  6 2012 13:01:46) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Relevant intl extension output from php -i:

Internationalization support => enabled
version => 1.1.0
ICU version => 4.8.1.1
ICU Data version => 4.8.1

Directive => Local Value => Master Value
intl.default_locale => no value => no value
intl.error_level => 0 => 0

And the test failures:

There were 12 failures:

1) Symfony\Component\Locale\Tests\Stub\StubIntlDateFormatterTest::testFormatWithDefaultTimezoneIntl
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1970-01-01 00:00:00'
+'1969-12-31 19:00:00'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php:481

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

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php:73

3) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #0 (100, 'BRL', 'BR', '%s$100.00')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$100.00'
+'R$100.00'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

4) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #1 (-100, 'BRL', 'BR', '(%s$100.00)')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'(BR$100.00)'
+'(R$100.00)'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

5) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #2 (1000.12, 'BRL', 'BR', '%s$1,000.12')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.12'
+'R$1,000.12'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

6) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #3 (1000.121, 'BRL', 'BR', '%s$1,000.12')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.12'
+'R$1,000.12'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

7) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #4 (1000.123, 'BRL', 'BR', '%s$1,000.12')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.12'
+'R$1,000.12'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

8) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #5 (1000.125, 'BRL', 'BR', '%s$1,000.12')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.12'
+'R$1,000.12'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

9) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #6 (1000.127, 'BRL', 'BR', '%s$1,000.13')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.13'
+'R$1,000.13'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

10) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #7 (1000.129, 'BRL', 'BR', '%s$1,000.13')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$1,000.13'
+'R$1,000.13'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

11) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #8 (11.50999, 'BRL', 'BR', '%s$11.51')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$11.51'
+'R$11.51'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

12) Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest::testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub with data set #9 (11.9999464, 'BRL', 'BR', '%s$12.00')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'BR$12.00'
+'R$12.00'

/home/jmikola/workspace/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:195

FAILURES!
Tests: 7721, Assertions: 17729, Failures: 12, Incomplete: 11, Skipped: 46.

Perhaps there is an issue with Symfony\Component\Locale\Tests\TestCase::isSameAsIcuVersion(), as it's the common factor for all of the Brazilian currency tests. I'm not sure what might be causing the first date test failure. My INI configuration has date.timezone = "America/New_York", but I don't think the test should require a UTC timezone.

@ghost
Copy link

ghost commented Aug 17, 2012

@jmikola Can you please run the Locale tests in this way?

php src/Symfony/Component/Locale/Resources/data/build-data.php
export USE_INTL_ICU_DATA_VERSION=true
phpunit src/Symfony/Component/Locale/Tests

We're shipping with ICU 49.1.2 data now, so it is needed to build the data for yours ICU version (ext/intl) before running the tests.

@jmikola
Copy link
Contributor Author

jmikola commented Aug 17, 2012

@eriksencosta: That resolved the Brazilian currency tests, although the date test still fails.

Is the necessity of build-data.php documented anywhere? I either missed it, or we should probably add it somewhere :)

@ghost
Copy link

ghost commented Aug 17, 2012

@jmikola Yes, it's documented in the component README file.

Yes, I need to look this date failing test case. What is your environment and PHP timezone?

@jmikola
Copy link
Contributor Author

jmikola commented Aug 17, 2012

$ uname -a
Linux honeydew 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ php -v
PHP 5.4.4-4~precise+1 (cli) (built: Aug  6 2012 13:01:46) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Timezone is "America/New_York". Thanks.

@ghost
Copy link

ghost commented Aug 28, 2012

@jmikola Can you please paste here the output of the icuinfo command?

$ which icuinfo
$ /usr/bin/icuinfo

@jmikola
Copy link
Contributor Author

jmikola commented Aug 28, 2012

$ which icuinfo
/usr/bin/icuinfo

$ icuinfo 
<ICUINFO>
International Components for Unicode for C/C++
 Copyright (C) 2011, International Business Machines Corporation and others. All Rights Reserved. 
Compiled-Version: 4.8.1.1
Runtime-Version: 4.8.1.1
Compiled-Unicode-Version: 6.0
Runtime-Unicode-Version: 6.0
Platform: U_LINUX
Build: x86_64-pc-linux-gnu
C compiler: gcc
C++ compiler: g++
ICUDATA: icudt48l
Data Directory: 
ICU Initialization returned: U_ZERO_ERROR
Default locale: en_US
CLDR-Version: 2.0.1
Default converter: UTF-8
Default TZ: US/Eastern
TZ data version: 2011k
Plugin file is: /usr/lib/icu/icuplugins48.txt
</ICUINFO>

@ghost
Copy link

ghost commented Aug 28, 2012

Thanks @jmikola. I'll investigate that. PHP 5.4.4 changed the default behavior for the IntlDateFormatter regarding the default timezone to use.

@ghost
Copy link

ghost commented Aug 29, 2012

The problem here is that ICU uses the system's timezone while PHP uses the timezone set in its php.ini file. I need to find a way that works on Windows and *nix to get the system timezone since this feature was removed from date_default_timezone_get() in PHP 5.4.0.

fabpot added a commit that referenced this issue Dec 12, 2012
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 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.
@jmikola
Copy link
Contributor Author

jmikola commented Dec 13, 2012

I believe this is now fixed by #6109 and can be closed.

@jmikola jmikola closed this as completed Dec 13, 2012
fabpot added a commit that referenced this issue Jan 5, 2013
This PR was merged into the master branch.

Commits
-------

97bc257 [Locale] Rolled back normalizeIcuVersion() method in unit tests.

Discussion
----------

[Locale] Rolled back normalizeIcuVersion() method in unit tests.

We just need to check if version is 4.4 or 4.8 and we do not need to know if it is 4.8.0 or 4.8.1.1 (at least for now there are no big differences between minor ICU versions).

This change basically rolls back modifications made in #6109 to fix #5288. Those modifications didn't really fix the issue since ICU>=4.9 wasn't handled properly. Part of the roll back was made in #6515 (2.1 branch).

This change makes master branch consistent with what we have in 2.0 and 2.1 (bespoke tests are passing in those branches).

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: one test fails in the Propel1 bridge
Fixes the following tickets: #5517
Todo: -
License of the code: MIT
Documentation PR: -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant