Skip to content

Commit a98c48b

Browse files
committed
DurationConverterTest coverage increased
1 parent 143396a commit a98c48b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/SDK/Helper/DurationConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function toDay(string $duration, ?string $format = 'l') : float
6060

6161
public static function toMonth(string $duration, ?string $format = 'l') : float
6262
{
63-
return self::toDay($duration, $format) / 30;
63+
return round(self::toDay($duration, $format) / 30, 2);
6464
}
6565

6666
public static function toYear(string $duration, ?string $format = 'l') : float

tests/unit/Helper/DurationConverterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function shouldConvertDurationToYearSuccessfully() : void
4646
public function shouldConvertDurationToMonthSuccessfully() : void
4747
{
4848
$duration = 'P0Y9M4DT1H5M0S';
49-
$expected = round( 9*30/365 + 4/365 + 1/365/60 + 5/365/60/60, 2);
49+
$expected = round( 9 + 4/30 + 1/30/60 + 5/30/60/60, 2);
5050
$result = DurationConverter::toMonth($duration);
51-
$this->assertEquals($expected, $result);
51+
$this->assertEquals($expected, $result, 'shouldConvertDurationToMonthSuccessfully');
5252
}
5353
}

0 commit comments

Comments
 (0)