From fc1e844bed66989f36a129fec1a1c7f3a8c31339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Fri, 10 Aug 2012 14:19:33 +0200 Subject: [PATCH] [Locale] Fixed tests --- phpunit.xml.dist | 1 + .../Locale/Tests/Stub/StubIntlDateFormatterTest.php | 2 +- .../Locale/Tests/Stub/StubNumberFormatterTest.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 64f0b50fa4..4385de9da9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,6 +13,7 @@ > + diff --git a/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php b/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php index fb9835694b..4e0ce224f9 100644 --- a/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php +++ b/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php @@ -472,7 +472,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase $this->skipIfIntlExtensionIsNotLoaded(); $this->skipIfICUVersionIsTooOld(); - $formatter = new \IntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT); + $formatter = new \IntlDateFormatter('en', StubIntlDateFormatter::MEDIUM, StubIntlDateFormatter::SHORT, 'UTC'); $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); $this->assertEquals( diff --git a/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php b/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php index 4286e9d744..9471f820d1 100644 --- a/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php +++ b/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php @@ -160,6 +160,7 @@ class StubNumberFormatterTest extends LocaleTestCase */ public function testFormatCurrencyWithCurrencyStyleCostaRicanColonsRoundingStub($value, $currency, $symbol, $expected) { + $this->skipIfICUDataVersionNotDefined(); $formatter = $this->getStubFormatterWithCurrencyStyle(); $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); } @@ -191,6 +192,7 @@ class StubNumberFormatterTest extends LocaleTestCase */ public function testFormatCurrencyWithCurrencyStyleBrazilianRealRoundingStub($value, $currency, $symbol, $expected) { + $this->skipIfICUDataVersionNotDefined(); $formatter = $this->getStubFormatterWithCurrencyStyle(); $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); } @@ -231,6 +233,7 @@ class StubNumberFormatterTest extends LocaleTestCase */ public function testFormatCurrencyWithCurrencyStyleSwissRoundingStub($value, $currency, $symbol, $expected) { + $this->skipIfICUDataVersionNotDefined(); $formatter = $this->getStubFormatterWithCurrencyStyle(); $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); } @@ -1192,4 +1195,11 @@ class StubNumberFormatterTest extends LocaleTestCase return $formatter; } + + protected function skipIfICUDataVersionNotDefined() + { + if (!getenv('USE_INTL_ICU_DATA_VERSION')) { + $this->markTestSkipped('Please set environment variable USE_INTL_ICU_DATA_VERSION.'); + } + } }