generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74d1956
commit 7a09493
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Luxembourg extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'lu'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Neijoerschdag' => '01-01', | ||
'Dag vun der Aarbecht' => '05-01', | ||
'Europadag' => '05-09', | ||
'Nationalfeierdag' => '06-23', | ||
'Mariä Himmelfahrt' => '08-15', | ||
'Allerhellgen' => '11-01', | ||
'Chrëschtdag' => '12-25', | ||
'Stiefesdag' => '12-26', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$easter = $this->easter($year); | ||
|
||
return [ | ||
'Ouschterméindeg' => $easter->addDay(), | ||
'Christi Himmelfahrt' => $easter->addDays(39), | ||
'Péngschtméindeg' => $easter->addDays(50), | ||
]; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/.pest/snapshots/Countries/LuxembourgTest/it_can_calculate_luxembourgish_holidays.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[ | ||
{ | ||
"name": "Neijoerschdag", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Ouschterm\u00e9indeg", | ||
"date": "2024-04-01" | ||
}, | ||
{ | ||
"name": "Dag vun der Aarbecht", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "Europadag", | ||
"date": "2024-05-09" | ||
}, | ||
{ | ||
"name": "Christi Himmelfahrt", | ||
"date": "2024-05-09" | ||
}, | ||
{ | ||
"name": "P\u00e9ngschtm\u00e9indeg", | ||
"date": "2024-05-20" | ||
}, | ||
{ | ||
"name": "Nationalfeierdag", | ||
"date": "2024-06-23" | ||
}, | ||
{ | ||
"name": "Mari\u00e4 Himmelfahrt", | ||
"date": "2024-08-15" | ||
}, | ||
{ | ||
"name": "Allerhellgen", | ||
"date": "2024-11-01" | ||
}, | ||
{ | ||
"name": "Chr\u00ebschtdag", | ||
"date": "2024-12-25" | ||
}, | ||
{ | ||
"name": "Stiefesdag", | ||
"date": "2024-12-26" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Tests\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Holidays; | ||
|
||
it('can calculate luxembourgish holidays', function () { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'lu')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |