Skip to content

Commit

Permalink
HP-2212 Fix falling phpunit-legacy Unit tests after add Since and Til…
Browse files Browse the repository at this point in the history
…l properties to Bill (#91)

* HP-2212 Fix falling phpunit-legacy Unit tests

* HP-2212 initialize default value for Bill::$usageInterval property
  • Loading branch information
VadymHrechukha authored Nov 22, 2024
1 parent d568ee3 commit 54f3d75
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bill/Bill.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function __construct(
$this->plan = $plan;
$this->charges = $charges;
$this->state = $state;
$this->setUsageInterval(UsageInterval::wholeMonth($time));
}

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

public function getUsageInterval(): UsageInterval
{
if ($this->usageInterval === null) {
$this->initializeWholeMonthUsageInterval();
}

return $this->usageInterval;
}

private function initializeWholeMonthUsageInterval(): void
{
$this->setUsageInterval(UsageInterval::wholeMonth($this->time));
}

public function calculatePrice()
{
$quantity = $this->quantity->getQuantity();
Expand Down

0 comments on commit 54f3d75

Please sign in to comment.