allow negative duration via internal API (#3573)

This commit is contained in:
Kevin Papst
2022-10-10 17:47:11 +02:00
committed by GitHub
parent 1959d4d8df
commit 0cefcf0e16
9 changed files with 39 additions and 46 deletions

View File

@@ -520,12 +520,23 @@ class LocaleFormatExtensionsTest extends TestCase
// test negative duration
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('0.00', $sut->durationDecimal(-1));
$this->assertEquals('-0.00', $sut->durationDecimal(-1));
// test negative duration
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('-0.01', $sut->durationDecimal(-50));
// test negative duration - with rounding issue
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('-0.02', $sut->durationDecimal(-60));
// test zero duration
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('0.00', $sut->durationDecimal(0));
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('0.00', $sut->durationDecimal(-0));
$sut = $this->getSut($this->localeEn, 'en');
$this->assertEquals('0.00', $sut->durationDecimal(null));