Commit 62e7c3e9 by Carsten Brandt

fixed some inconsistnecies in HHVM tests

exclude parts that have different default values
parent 10512ff0
......@@ -249,7 +249,7 @@ class Formatter extends \yii\base\Formatter
/**
* Formats the value as a decimal number.
* @param mixed $value the value to be formatted
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details)
* for details on how to specify a format.
* @return string the formatted result.
*/
......@@ -267,7 +267,7 @@ class Formatter extends \yii\base\Formatter
* @param mixed $value the value to be formatted
* @param string $currency the 3-letter ISO 4217 currency code indicating the currency to use.
* If null, [[currencyCode]] will be used.
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details)
* for details on how to specify a format.
* @return string the formatted result.
*/
......@@ -287,7 +287,7 @@ class Formatter extends \yii\base\Formatter
/**
* Formats the value as a percent number.
* @param mixed $value the value to be formatted
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details)
* for details on how to specify a format.
* @return string the formatted result.
*/
......@@ -303,7 +303,7 @@ class Formatter extends \yii\base\Formatter
/**
* Formats the value as a scientific number.
* @param mixed $value the value to be formatted
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details)
* for details on how to specify a format.
* @return string the formatted result.
*/
......@@ -319,7 +319,7 @@ class Formatter extends \yii\base\Formatter
/**
* Creates a number formatter based on the given type and format.
* @param integer $type the type of the number formatter
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details)
* @return NumberFormatter the created formatter instance
*/
protected function createNumberFormatter($type, $format)
......
......@@ -265,7 +265,10 @@ class FormatterTest extends TestCase
$this->assertSame('12 years ago', $this->formatter->asRelativeTime($interval_12_years));
// Pass a DateInterval string
if (!defined('HHVM_VERSION')) {
// TODO format not supported by HHVM currently https://github.com/facebook/hhvm/issues/2952
$this->assertSame('a year ago', $this->formatter->asRelativeTime('2007-03-01T13:00:00Z/2008-05-11T15:30:00Z'));
}
$this->assertSame('a year ago', $this->formatter->asRelativeTime('2007-03-01T13:00:00Z/P1Y2M10DT2H30M'));
$this->assertSame('a year ago', $this->formatter->asRelativeTime('P1Y2M10DT2H30M/2008-05-11T15:30:00Z'));
$this->assertSame('a year ago', $this->formatter->asRelativeTime('P1Y2M10DT2H30M'));
......@@ -324,7 +327,10 @@ class FormatterTest extends TestCase
$this->assertSame('in 12 years', $this->formatter->asRelativeTime($interval_12_years));
// Pass a inverted DateInterval string
if (!defined('HHVM_VERSION')) {
// TODO format not supported by HHVM currently https://github.com/facebook/hhvm/issues/2952
$this->assertSame('in a year', $this->formatter->asRelativeTime('2008-05-11T15:30:00Z/2007-03-01T13:00:00Z'));
}
// Force the reference time and pass a future DateTime
$dateNow = new DateTime('2014-03-13');
......
......@@ -47,12 +47,19 @@ class FormatterTest extends TestCase
$value = '123456';
$this->assertSame("123,456", $this->formatter->asDecimal($value));
$value = '-123456.123';
if (defined('HHVM_VERSION')) { // the default format is different on HHVM
$this->assertSame("-123,456", $this->formatter->asDecimal($value));
} else {
$this->assertSame("-123,456.123", $this->formatter->asDecimal($value));
}
$this->assertSame($this->formatter->nullDisplay, $this->formatter->asDecimal(null));
}
public function testAsPercent()
{
if (defined('HHVM_VERSION')) { // the default format is different on HHVM
$this->markTestSkipped('HHVM behaves quite different in the default patterns used for formatting.');
}
$value = '123';
$this->assertSame('12,300%', $this->formatter->asPercent($value));
$value = '0.1234';
......@@ -64,6 +71,9 @@ class FormatterTest extends TestCase
public function testAsScientific()
{
if (defined('HHVM_VERSION')) { // the default format is different on HHVM
$this->markTestSkipped('HHVM behaves quite different in the default patterns used for formatting.');
}
$value = '123';
$this->assertSame('1.23E2', $this->formatter->asScientific($value));
$value = '123456';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment