Permalink
Browse files

[Locale] Fixed tests

  • Loading branch information...
1 parent 237629a commit fc1e844bed66989f36a129fec1a1c7f3a8c31339 @hason hason committed Aug 10, 2012
View
@@ -13,6 +13,7 @@
>
<php>
<ini name="intl.default_locale" value="en"/>
+ <ini name="intl.error_level" value="0"/>
</php>
<testsuites>
@@ -472,7 +472,7 @@ public function testFormatWithDefaultTimezoneIntl()
$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(
@@ -160,6 +160,7 @@ public function formatCurrencyWithCurrencyStyleProvider()
*/
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 @@ public function formatCurrencyWithCurrencyStyleCostaRicanColonsRoundingProvider(
*/
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 @@ public function formatCurrencyWithCurrencyStyleBrazilianRealRoundingProvider()
*/
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 @@ protected function getIntlFormatterWithCurrencyStyle()
return $formatter;
}
+
+ protected function skipIfICUDataVersionNotDefined()
+ {
+ if (!getenv('USE_INTL_ICU_DATA_VERSION')) {
+ $this->markTestSkipped('Please set environment variable USE_INTL_ICU_DATA_VERSION.');
+ }
+ }
}

0 comments on commit fc1e844

Please sign in to comment.