Skip to content

Commit 54f3d75

Browse files
HP-2212 Fix falling phpunit-legacy Unit tests after add Since and Till properties to Bill (#91)
* HP-2212 Fix falling phpunit-legacy Unit tests * HP-2212 initialize default value for Bill::$usageInterval property
1 parent d568ee3 commit 54f3d75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bill/Bill.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public function __construct(
8989
$this->plan = $plan;
9090
$this->charges = $charges;
9191
$this->state = $state;
92-
$this->setUsageInterval(UsageInterval::wholeMonth($time));
9392
}
9493

9594
/**
@@ -111,9 +110,18 @@ public function getUniqueString(): string
111110

112111
public function getUsageInterval(): UsageInterval
113112
{
113+
if ($this->usageInterval === null) {
114+
$this->initializeWholeMonthUsageInterval();
115+
}
116+
114117
return $this->usageInterval;
115118
}
116119

120+
private function initializeWholeMonthUsageInterval(): void
121+
{
122+
$this->setUsageInterval(UsageInterval::wholeMonth($this->time));
123+
}
124+
117125
public function calculatePrice()
118126
{
119127
$quantity = $this->quantity->getQuantity();

0 commit comments

Comments
 (0)