From 342695893b36966752b986d480a09d405d33fa3f Mon Sep 17 00:00:00 2001 From: Antoine Rolland Date: Thu, 6 Jul 2023 17:23:03 +0200 Subject: [PATCH] Fix holiday api test Non premium account can only fetch holidays from last year --- test/Integration/HolidayApiFRBusinessCalendarTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/Integration/HolidayApiFRBusinessCalendarTest.php b/test/Integration/HolidayApiFRBusinessCalendarTest.php index 341b040..154931a 100644 --- a/test/Integration/HolidayApiFRBusinessCalendarTest.php +++ b/test/Integration/HolidayApiFRBusinessCalendarTest.php @@ -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); } @@ -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'; + } }