Skip to content

Commit

Permalink
test: update Switzerland tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Welte committed Jan 27, 2024
1 parent f3e527d commit b507f15
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"name": "Capodanno",
"date": "2024-01-01"
},
{
"name": "San Silvestro",
"date": "2024-01-02"
},
{
"name": "Venerd\u00ec Santo",
"date": "2024-03-29"
},
{
"name": "Luned\u00ec di Pasqua",
"date": "2024-04-01"
},
{
"name": "Ascensione",
"date": "2024-05-09"
},
{
"name": "Luned\u00ec di Pentecoste",
"date": "2024-05-20"
},
{
"name": "Festa nazionale",
"date": "2024-08-01"
},
{
"name": "Natale",
"date": "2024-12-25"
},
{
"name": "Santo Stefano",
"date": "2024-12-26"
}
]
18 changes: 10 additions & 8 deletions tests/Countries/SwitzerlandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@
new Switzerland('ch-xx');
})->throws(InvalidRegion::class);

it('can translate swiss holidays', function() {
CarbonImmutable::setTestNowAndTimezone('2024-01-01');
it('can translate swiss holidays into french', function() {
$holidays = Holidays::for(country: 'ch', locale: 'fr', year: 2024)->get();

$switzerland = new Switzerland(locale: 'fr');
expect($holidays)
->toBeArray()
->not()->toBeEmpty();

$holidays = Holidays::for($switzerland)->get();
expect(formatDates($holidays))->toMatchSnapshot();
});

it('can translate swiss holidays into italian', function() {
$holidays = Holidays::for(country: 'ch', locale: 'it', year: 2024)->get();

expect($holidays)
->toBeArray()
->not()->toBeEmpty();

expect(formatDates($holidays))->toMatchSnapshot();
});

it('throws an error when an invalid locale is given', function () {
new Switzerland(locale: 'xx');
})->throws(InvalidRegion::class);

0 comments on commit b507f15

Please sign in to comment.