Skip to content

Commit

Permalink
minor #21320 Fix ICU dependant tests (jakzal)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.7 branch (closes #21320).

Discussion
----------

Fix ICU dependant tests

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

#20551 changed the condition checking if the ICU version matches the stubbed data. The change intended to enable tests on more ICU versions, but it actually has limited them. I'm still not convinced it should've been done but let's at least fix the condition. Ideal solution would be to have the latest ICU data available on travis (still not there travis-ci/travis-ci#3616).

I also needed to fix several tests.

Currently skipped tests in components depending on ICU data:

|            | 4.8.1.1 | 54.1 | 55.1 | 57.1 |
|---|---|--|--|--|
| Intl       | 488     | 488  | 7    | 6    |
| Locale     | 0       | 0    | 0    | 0    |
| Translation| 0       | 0    | 0    | 0    |
| Validator  | 69      | 69   | 69   | 0    |
| Form       | 75      | 75   | 75   | 1    |

Commits
-------

d3b5d8e Fix tests with ICU 57.1
677d820 Fix the condition checking the minimum ICU version
  • Loading branch information
fabpot committed Jan 24, 2017
2 parents 0292cf2 + d3b5d8e commit 388be9d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Expand Up @@ -108,10 +108,10 @@ public function testReverseTransformEmpty()

public function testReverseTransformWithGrouping()
{
// Since we test against "de_AT", we need the full implementation
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$transformer = new IntegerToLocalizedStringTransformer(null, true);

Expand Down
Expand Up @@ -54,8 +54,8 @@ public function testTransform($from, $to, $locale)
public function provideTransformationsWithGrouping()
{
return array(
array(1234.5, '1.234,5', 'de_AT'),
array(12345.912, '12.345,912', 'de_AT'),
array(1234.5, '1.234,5', 'de_DE'),
array(12345.912, '12.345,912', 'de_DE'),
array(1234.5, '1 234,5', 'fr'),
array(1234.5, '1 234,5', 'ru'),
array(1234.5, '1 234,5', 'fi'),
Expand Down Expand Up @@ -410,10 +410,10 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
*/
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
// Since we test against "de_AT", we need the full implementation
// Since we test against "de_DE", we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$transformer = new NumberToLocalizedStringTransformer(null, true);

Expand Down
Expand Up @@ -69,10 +69,10 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat()

public function testSubmitFromSingleTextDateTime()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand All @@ -90,10 +90,10 @@ public function testSubmitFromSingleTextDateTime()

public function testSubmitFromSingleTextString()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand All @@ -111,10 +111,10 @@ public function testSubmitFromSingleTextString()

public function testSubmitFromSingleTextTimestamp()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand All @@ -134,10 +134,10 @@ public function testSubmitFromSingleTextTimestamp()

public function testSubmitFromSingleTextRaw()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand Down Expand Up @@ -398,10 +398,10 @@ public function testThrowExceptionIfDaysIsInvalid()

public function testSetDataWithNegativeTimezoneOffsetStringInput()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand All @@ -420,10 +420,10 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput()

public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()
{
// we test against "de_AT", so we need the full implementation
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);

\Locale::setDefault('de_AT');
\Locale::setDefault('de_DE');

$form = $this->factory->create('date', null, array(
'format' => \IntlDateFormatter::MEDIUM,
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Intl/Util/IntlTestHelper.php
Expand Up @@ -41,7 +41,7 @@ public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minim
// * the intl extension is loaded with version Intl::getIcuStubVersion()
// * the intl extension is not loaded

if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) {
if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '<', 1)) {
$testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.');
}

Expand Down

0 comments on commit 388be9d

Please sign in to comment.