Skip to content

Commit

Permalink
Fix holiday api test
Browse files Browse the repository at this point in the history
Non premium account can only fetch holidays from last year
  • Loading branch information
natitech committed Jul 6, 2023
1 parent f2f3ecc commit 3426958
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/Integration/HolidayApiFRBusinessCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function canTouchApi()
{
$this->setApiKey($this->apiKey);

$this->add('2021/04/01', 10);
$this->add($this->lastYearOn1stApril(), 20);

$this->assertTrue(true);
}
Expand All @@ -44,4 +44,11 @@ protected function getCalendar(): BusinessCalendar
{
return new BusinessCalendar((new HolidayApiCalendar(new Client(['key' => $this->apiKey])))->forCountry('FR'));
}

private function lastYearOn1stApril(): string
{
$currentYear = (int)(new \DateTimeImmutable())->format('Y');

return ($currentYear - 1) . '/04/01';
}
}

0 comments on commit 3426958

Please sign in to comment.