diff --git a/lang/switzerland/de/holidays.json b/lang/switzerland/de/holidays.json index f59358468..22e14afdc 100644 --- a/lang/switzerland/de/holidays.json +++ b/lang/switzerland/de/holidays.json @@ -1,19 +1,17 @@ { - "Neujahr": "Neujahr", - "Berchtoldstag": "Berchtoldstag", - "Heilige Drei Könige": "Heilige Drei Könige", - "Josefstag": "Josefstag", - "Karfreitag": "Karfreitag", - "Ostermontag": "Ostermontag", - "Tag der Arbeit": "Tag der Arbeit", - "Auffahrt": "Auffahrt", - "Pfingstmontag": "Pfingstmontag", - "Fronleichnam": "Fronleichnam", - "Bundesfeier": "Bundesfeier", - "Maria Himmelfahrt": "Maria Himmelfahrt", - "Buss- und Bettag" : "Buss- und Bettag", - "Allerheiligen": "Allerheiligen", - "Maria Empfängnis": "Maria Empfängnis", - "Weihnachtstag": "Weihnachtstag", - "Stephanstag": "Stephanstag" + "New Year's Day" : "Neujahrstag", + "Berchtold's Day" : "Berchtoldstag", + "St. Joseph's Day" : "Josefstag", + "Good Friday" : "Karfreitag", + "Easter Monday" : "Ostermontag", + "Ascension Day" : "Auffahrt", + "Whit Monday" : "Pfingstmontag", + "Corpus Christi" : "Fronleichnam", + "Swiss National Day" : "Bundesfeier", + "Assumption Day" : "Mariä Himmelfahrt", + "All Saints' Day" : "Allerheiligen", + "Immaculate Conception" : "Mariä Empfängnis", + "Christmas Day" : "Weihnachtstag", + "St. Stephen's Day" : "Stephanstag", + "Labour Day" : "1. Mai" } diff --git a/lang/switzerland/fr/holidays.json b/lang/switzerland/fr/holidays.json index 28a04b822..d36d94b0a 100644 --- a/lang/switzerland/fr/holidays.json +++ b/lang/switzerland/fr/holidays.json @@ -1,19 +1,17 @@ { - "Neujahr": "Nouvel An", - "Berchtoldstag": "Saint-Berthold", - "Heilige Drei Könige": "Épiphanie", - "Josefstag": "Saint-Joseph", - "Karfreitag": "Vendredi saint", - "Ostermontag": "Lundi de Pâques", - "Tag der Arbeit": "Fête du travail", - "Auffahrt": "Ascension", - "Pfingstmontag": "Lundi de Pentecôte", - "Fronleichnam": "Fête-Dieu", - "Bundesfeier": "Fête nationale", - "Maria Himmelfahrt": "Assomption", - "Buss- und Bettag": "Jeûne fédéral", - "Allerheiligen": "Toussaint", - "Maria Empfängnis": "Immaculée Conception", - "Weihnachtstag": "Noël", - "Stephanstag": "Saint-Étienne" + "New Year's Day": "Nouvel an", + "Berchtold's Day": "2 janvier", + "St. Joseph's Day": "Saint-Joseph", + "Good Friday": "Vendredi saint", + "Easter Monday": "Lundi de Pâques", + "Ascension Day": "Ascension", + "Whit Monday": "Lundi de Pentecôte", + "Corpus Christi": "Fête-Dieu", + "Swiss National Day": "Fête nationale", + "Assumption Day": "Assomption", + "All Saints' Day": "Toussaint", + "Immaculate Conception": "Immaculée Conception", + "Christmas Day": "Noël", + "St. Stephen's Day": "Saint-Étienne", + "Labour Day" : "1er mai" } diff --git a/lang/switzerland/it/holidays.json b/lang/switzerland/it/holidays.json index e62ec667e..5fb81f449 100644 --- a/lang/switzerland/it/holidays.json +++ b/lang/switzerland/it/holidays.json @@ -1,19 +1,18 @@ { - "Neujahr": "Capodanno", - "Berchtoldstag": "San Silvestro", - "Heilige Drei Könige": "Epifania", - "Josefstag": "San Giuseppe", - "Karfreitag": "Venerdì Santo", - "Ostermontag": "Lunedì di Pasqua", - "Tag der Arbeit": "Festa del lavoro", - "Auffahrt": "Ascensione", - "Pfingstmontag": "Lunedì di Pentecoste", - "Fronleichnam": "Corpus Domini", - "Bundesfeier": "Festa nazionale", - "Maria Himmelfahrt": "Assunzione", - "Buss- und Bettag": "Digiuno federale", - "Allerheiligen": "Ognissanti", - "Maria Empfängnis": "Immacolata Concezione", - "Weihnachtstag": "Natale", - "Stephanstag": "Santo Stefano" + "New Year's Day": "Capodanno", + "Berchtold's Day": "Giorno di Berchtold", + "St. Joseph's Day": "Giorno di San Giuseppe", + "Good Friday": "Venerdì santo", + "Easter Monday": "Lunedì di Pasqua", + "Ascension Day": "Ascensione", + "Whit Monday": "Glindesdi da Pentecosta", + "Corpus Christi": "Corpus Domini", + "Swiss National Day": "Festa nazionale", + "Assumption Day": "Assunta", + "All Saints' Day": "Ognissanti", + "Immaculate Conception": "Immacolata Concezione", + "Christmas Day": "Natale", + "St. Stephen's Day": "San Steffan", + "Three Kings' Day" : "Epifania", + "Labour Day": "Festa dei lavoratori" } diff --git a/lang/switzerland/rm/holidays.json b/lang/switzerland/rm/holidays.json new file mode 100644 index 000000000..df9aa11df --- /dev/null +++ b/lang/switzerland/rm/holidays.json @@ -0,0 +1,17 @@ +{ + "New Year's Day": "Bun di bun onn", + "Berchtold's Day": "Bun di San Berchtold", + "St. Joseph's Day": "Bun di San Giusep", + "Good Friday": "Venerdi San", + "Easter Monday": "Lun di Pasca", + "Ascension Day": "Ascensiun", + "Whit Monday": "Lun di Pentecoste", + "Corpus Christi": "Corpus Christi", + "Swiss National Day": "Festa naziunala", + "Assumption Day": "Assunziun", + "All Saints' Day": "Ognissanti", + "Immaculate Conception": "Immaculada Conceziun", + "Christmas Day": "Nadal", + "St. Stephen's Day": "San Stefaun", + "Labour Day": "Festa da lavur" +} diff --git a/src/Countries/Switzerland.php b/src/Countries/Switzerland.php index c2e9d157c..e5abc7f17 100644 --- a/src/Countries/Switzerland.php +++ b/src/Countries/Switzerland.php @@ -2,324 +2,657 @@ namespace Spatie\Holidays\Countries; +use _PHPStan_3d4486d07\Nette\Neon\Exception; use Carbon\CarbonImmutable; use Spatie\Holidays\Exceptions\InvalidRegion; class Switzerland extends Country { - private const REGIONS = [ - 'ch-ag', - 'ch-ar', - 'ch-ai', - 'ch-bl', - 'ch-bs', - 'ch-be', - 'ch-fr', - 'ch-ge', - 'ch-gl', - 'ch-gr', - 'ch-ju', - 'ch-lu', - 'ch-ne', - 'ch-nw', - 'ch-ow', - 'ch-sh', - 'ch-sz', - 'ch-so', - 'ch-sg', - 'ch-ti', - 'ch-tg', - 'ch-ur', - 'ch-vd', - 'ch-vs', - 'ch-zg', - 'ch-zh', - ]; + public function __construct( + protected ?string $region = null + ) { + } - private const NEW_YEARS_DAY = 'Neujahr'; + public function countryCode(): string + { + return 'ch'; + } - private const BERCHTOLDS_DAY = 'Berchtoldstag'; + protected function allHolidays(int $year): array + { - private const THREE_KINGS_DAY = 'Heilige Drei Könige'; + $holidays = array_merge([ + 'Swiss National Day' => '08-01', + ], + $this->getCatonalHolidays($year), + ); - private const SAINT_JOSEPHS_DAY = 'Josefstag'; + return $this->normalizeHolidayArray($holidays); + } - private const GOOD_FRIDAY = 'Karfreitag'; + /** + * This defaults to SBB/CFF/FFS holidays or postal holidays + * https://github.com/spatie/holidays/pull/49/files#r1462344840 + * + * @return non-empty-array|string> + */ + private function getDefaultSwissHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } - private const EASTER_MONDAY = 'Ostermontag'; + /** @return non-empty-array */ + private function getVariableHoliday(int $year, string $holiday): array + { + $easter = $this->easter($year); - private const LABOUR_DAY = 'Tag der Arbeit'; + $value = match ($holiday) { + 'Good Friday' => $easter->subDays(2), + 'Easter Monday' => $easter->addDay(), + 'Ascension Day' => $easter->addDays(39), + 'Whit Monday' => $easter->addDays(50), + 'Corpus Christi' => $easter->addDays(60), + default => throw new InvalidRegion('Variable holiday not supported'), + }; - private const ASCENSION_DAY = 'Auffahrt'; + return [$holiday => $value]; - private const WHIT_MONDAY = 'Pfingstmontag'; + } - private const CORPUS_CHRISTI = 'Fronleichnam'; + /** + * @param non-empty-array|string> $holidays + * @return array + */ + private function normalizeHolidayArray(array $holidays): array + { - private const SWISS_NATIONAL_HOLIDAY = 'Bundesfeier'; + $normalized_holidays = []; - private const ASSUMPTION_DAY = 'Maria Himmelfahrt'; + foreach ($holidays as $key => $value) { + if (is_array($value)) { - private const FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER = 'Buss- und Bettag'; + foreach ($value as $sub_key => $sub_value) { + $normalized_holidays[$sub_key] = $sub_value; - private const ALL_SAINTS_DAY = 'Allerheiligen'; + } - private const IMMACULATE_CONCEPTION = 'Maria Empfängnis'; + continue; + } - private const CHRISTMAS_DAY = 'Weihnachtstag'; + if (is_string($key)) { + $normalized_holidays[$key] = $value; + } + } - private const SAINT_STEPHENS_DAY = 'Stephanstag'; + return $normalized_holidays; + } - public function __construct(protected ?string $region = null) + /** @return array + * @throws Exception + */ + private function getCatonalHolidays(int $year): array { - if ($region !== null && ! in_array($region, self::REGIONS)) { - throw InvalidRegion::unsupportedRegion($region); + + if ($this->region === null) { + $default_holidays = $this->getDefaultSwissHolidays($year); + + return $this->normalizeHolidayArray($default_holidays); } + + $canton = explode('-', $this->region)[1]; + + $holidays = match ($canton) { + 'ag' => $this->getAGHolidays($year), + 'ar' => $this->getARHolidays($year), + 'ai' => $this->getAIHolidays($year), + 'bl' => $this->getBLHolidays($year), + 'bs' => $this->getBSHolidays($year), + 'be' => $this->getBEHolidays($year), + 'fr' => $this->getFRHolidays($year), + 'ge' => $this->getGEHolidays($year), + 'gl' => $this->getGLHolidays($year), + 'gr' => $this->getGRHolidays($year), + 'ju' => $this->getJUHolidays($year), + 'lu' => $this->getLUHolidays($year), + 'ne' => $this->getNEHolidays($year), + 'nw' => $this->getNWHolidays($year), + 'ow' => $this->getOWHolidays($year), + 'sh' => $this->getSHHolidays($year), + 'sz' => $this->getSZHolidays($year), + 'so' => $this->getSOHolidays($year), + 'sg' => $this->getSGHolidays($year), + 'ti' => $this->getTIHolidays($year), + 'tg' => $this->getTGHolidays($year), + 'ur' => $this->getURHolidays($year), + 'vd' => $this->getVDHolidays($year), + 'vs' => $this->getVSHolidays($year), + 'zg' => $this->getZGHolidays($year), + 'zh' => $this->getZHHolidays($year), + default => throw new InvalidRegion('Canton not supported'), + }; + + return $this->normalizeHolidayArray($holidays); } - public function countryCode(): string + /** + * @throws Exception + */ + private function createCarbonImmutable(int $year, int $month, int $day): CarbonImmutable { - return 'ch'; + $carbon_immutable = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$month}-{$day}"); + + // check if the date is valid + if (! $carbon_immutable) { + throw new Exception('Invalid date'); + } + + return $carbon_immutable; + } + + /** @return non-empty-array > */ + private function getAGHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getARHolidays(int $year): array + { + // check if Christmas day is on a monday or friday + $christmas_day = $this->createCarbonImmutable($year, 12, 25); + $christmas_day_is_monday_or_friday = in_array($christmas_day->dayOfWeek, [1, 5]); + + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + ], + $christmas_day_is_monday_or_friday ? [] : ['St. Stephen\'s Day' => '12-26'] + ); + + } + + /** @return non-empty-array|string > */ + private function getAIHolidays(int $year): array + { + // check if Christmas day is on a monday or friday + $christmas_day = $this->createCarbonImmutable($year, 12, 25); + $christmas_day_is_monday_or_friday = in_array($christmas_day->dayOfWeek, [1, 5]); + + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'Mauritiustag' => '09-22', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + ], + $christmas_day_is_monday_or_friday ? [] : ['St. Stephen\'s Day' => '12-26'] + ); + } + + /** @return non-empty-array|string > */ + private function getBLHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getBSHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getBEHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; } /** - * @return array + * except some municipalities in the "Bezirk See / district du Lac" do not share these holidays. + * These holidays are only valid for the canton however, not for these municipalities. + * + * @return non-empty-array|string> */ - public function regionalHolidays(int $year): array + private function getFRHolidays(int $year): array { - if ($this->region === null) { - return []; - } + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); + } - $easter = $this->easter($year); + /** @return non-empty-array|string > */ + private function getGEHolidays(int $year): array + { + // get the first day of september + $first_september = $this->createCarbonImmutable($year, 9, 1); + + // check if first september is a sunday + $first_september_is_sunday = $first_september->dayOfWeek === 0; - $sharedHolidays = [ - self::NEW_YEARS_DAY => '01-01', - self::ASCENSION_DAY => $easter->addDays(39), - self::SWISS_NATIONAL_HOLIDAY => '08-01', - self::CHRISTMAS_DAY => '12-25', + // get first sunday of september + $first_sunday_of_september = $first_september_is_sunday ? $first_september : $first_september->next('sunday'); + + // get the following thursday + $jeune_genevois = $first_sunday_of_september->next('thursday'); + + return [ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Jeûne genevois' => $jeune_genevois, + 'Christmas Day' => '12-25', + 'Restauration de la République' => '12-31', ]; + } + + /** @return non-empty-array|string > */ + private function getGLHolidays(int $year): array + { + // get the first day of april + $first_april = $this->createCarbonImmutable($year, 4, 1); + + // check if first april is a thursday + $first_april_is_thursday = $first_april->dayOfWeek === 4; + + // get first thursday of april + $first_thursday_of_april = $first_april_is_thursday ? $first_april : $first_april->next('thursday'); - $regionallyDifferentHolidays = [ - self::BERCHTOLDS_DAY => '01-02', - self::THREE_KINGS_DAY => '01-06', - self::SAINT_JOSEPHS_DAY => '03-19', - self::GOOD_FRIDAY => $easter->subDays(2), - self::EASTER_MONDAY => $easter->addDay(), - self::LABOUR_DAY => '05-01', - self::WHIT_MONDAY => $easter->addDays(50), - self::CORPUS_CHRISTI => $easter->addDays(60), - self::ASSUMPTION_DAY => '08-15', - self::FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER => new CarbonImmutable('third sunday of September '.$year, 'Europe/Zurich'), - self::ALL_SAINTS_DAY => '11-01', - self::IMMACULATE_CONCEPTION => '12-08', - self::SAINT_STEPHENS_DAY => '12-26', + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Fahrtsfest' => $first_thursday_of_april, + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'All Saints\' Day' => '11-01', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', ]; + } - $currentRegion = match ($this->region) { - 'ch-ag' => [ - self::GOOD_FRIDAY, - ], - 'ch-ar' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-ai' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::CORPUS_CHRISTI, - self::SAINT_STEPHENS_DAY, - ], - 'ch-bl' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::LABOUR_DAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-bs' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::LABOUR_DAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-be' => [ - self::BERCHTOLDS_DAY, - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-fr' => [ - self::GOOD_FRIDAY, - ], - 'ch-ge' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - ], - 'ch-gl' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - ], - 'ch-gr' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-ju' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::LABOUR_DAY, - self::WHIT_MONDAY, - self::CORPUS_CHRISTI, - ], - 'ch-lu' => [ - self::GOOD_FRIDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-ne' => [ - self::GOOD_FRIDAY, - self::LABOUR_DAY, - ], - 'ch-nw' => [ - self::GOOD_FRIDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - ], - 'ch-ow' => [ - self::GOOD_FRIDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - ], - 'ch-sh' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-sz' => [ - self::SAINT_JOSEPHS_DAY, - self::GOOD_FRIDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - ], - 'ch-so' => [ - self::GOOD_FRIDAY, - ], - 'ch-sg' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::ALL_SAINTS_DAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-ti' => [ - self::THREE_KINGS_DAY, - self::EASTER_MONDAY, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-tg' => [ - self::BERCHTOLDS_DAY, - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::SAINT_STEPHENS_DAY, - ], - 'ch-ur' => [ - self::THREE_KINGS_DAY, - self::SAINT_JOSEPHS_DAY, - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - self::SAINT_STEPHENS_DAY, - ], - 'ch-vd' => [ - self::BERCHTOLDS_DAY, - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::WHIT_MONDAY, - ], - 'ch-vs' => [ - self::SAINT_JOSEPHS_DAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - ], - 'ch-zg' => [ - self::GOOD_FRIDAY, - self::CORPUS_CHRISTI, - self::ASSUMPTION_DAY, - self::ALL_SAINTS_DAY, - self::IMMACULATE_CONCEPTION, - ], - 'ch-zh' => [ - self::GOOD_FRIDAY, - self::EASTER_MONDAY, - self::LABOUR_DAY, - self::WHIT_MONDAY, - self::FEDERAL_DAY_OF_THANKSGIVING_REPENTANCE_AND_PRAYER, - self::SAINT_STEPHENS_DAY, - ], - default => [], - }; + /** @return non-empty-array|string > */ + private function getGRHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } - $regionalHolidays = array_filter( - $regionallyDifferentHolidays, - fn ($key) => in_array($key, $currentRegion), - ARRAY_FILTER_USE_KEY - ); + /** @return non-empty-array|string > */ + private function getJUHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Commémoration du plébiscite jurassien' => '06-23', + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Christmas Day' => '12-25', + ]; + } - return array_merge($regionalHolidays, $sharedHolidays); + /** @return non-empty-array|string > */ + private function getLUHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; } - protected function allHolidays(int $year): array + /** @return non-empty-array|string > */ + private function getNEHolidays(int $year): array { - if ($this->region !== null) { - return $this->regionalHolidays($year); - } + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + 'Establishment of the republic' => '03-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + 'Labour Day' => '05-01', + ]; + } + /** @return non-empty-array|string > */ + private function getNWHolidays(int $year): array + { return array_merge([ - self::NEW_YEARS_DAY => '01-01', - self::BERCHTOLDS_DAY => '01-02', - self::SWISS_NATIONAL_HOLIDAY => '08-01', - self::CHRISTMAS_DAY => '12-25', - self::SAINT_STEPHENS_DAY => '12-26', - ], $this->variableHolidays($year)); + 'New Year\'s Day' => '01-01', + 'Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); } - /** @return array */ - protected function variableHolidays(int $year): array + /** @return non-empty-array|string > */ + private function getOWHolidays(int $year): array { - $easter = $this->easter($year); + return array_merge([ + 'New Year\'s Day' => '01-01', + 'St. Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); + } + + /** @return non-empty-array|string > */ + private function getSHHolidays(int $year): array + { + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ], [ + 'Berchtold\'s Day' => '01-02', + ]); + } + + /** @return non-empty-array|string > */ + private function getSZHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Dreikönigstag' => '01-06', + 'St. Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getSOHolidays(int $year): array + { + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Christmas Day' => '12-25', + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); + } + + /** @return non-empty-array|string > */ + private function getSGHolidays(int $year): array + { + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'All Saints\' Day' => '11-01', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ], [ + 'Berchtold\'s Day' => '01-02', + ]); + } + + /** @return non-empty-array|string > */ + private function getTIHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Epifania' => '01-06', + 'St. Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'San Pietro e Paolo' => '06-29', + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getTGHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + /** @return non-empty-array|string > */ + private function getURHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Dreikönigstag' => '01-06', + 'St. Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', + ]; + } + + /** @return non-empty-array|string > */ + private function getVDHolidays(int $year): array + { + return [ + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + ]; + } + + /** @return non-empty-array|string > */ + private function getVSHolidays(int $year): array + { + return array_merge([ + 'New Year\'s Day' => '01-01', + 'St. Joseph\'s Day' => '03-19', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); + } + + /** @return non-empty-array|string > */ + private function getZGHolidays(int $year): array + { + return array_merge([ + 'New Year\'s Day' => '01-01', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Corpus Christi'), + 'Assumption Day' => '08-15', + 'All Saints\' Day' => '11-01', + 'Immaculate Conception' => '12-08', + 'Christmas Day' => '12-25', + ], [ + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Easter Monday'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'St. Stephen\'s Day' => '12-26', + ]); + } + + /** @return non-empty-array|string > */ + private function getZHHolidays(int $year): array + { return [ - self::GOOD_FRIDAY => $easter->subDays(2), - self::EASTER_MONDAY => $easter->addDay(), - self::ASCENSION_DAY => $easter->addDays(39), - self::WHIT_MONDAY => $easter->addDays(50), + 'New Year\'s Day' => '01-01', + 'Berchtold\'s Day' => '01-02', + $this->getVariableHoliday($year, 'Good Friday'), + $this->getVariableHoliday($year, 'Easter Monday'), + 'Labour Day' => '05-01', + $this->getVariableHoliday($year, 'Ascension Day'), + $this->getVariableHoliday($year, 'Whit Monday'), + 'Christmas Day' => '12-25', + 'St. Stephen\'s Day' => '12-26', ]; } } diff --git "a/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____de______de__.snap" "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____de______de__.snap" new file mode 100644 index 000000000..8b1f45f25 --- /dev/null +++ "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____de______de__.snap" @@ -0,0 +1,38 @@ +[ + { + "name": "Neujahrstag", + "date": "2023-01-01" + }, + { + "name": "Berchtoldstag", + "date": "2023-01-02" + }, + { + "name": "Karfreitag", + "date": "2023-04-07" + }, + { + "name": "Ostermontag", + "date": "2023-04-10" + }, + { + "name": "Auffahrt", + "date": "2023-05-18" + }, + { + "name": "Pfingstmontag", + "date": "2023-05-29" + }, + { + "name": "Bundesfeier", + "date": "2023-08-01" + }, + { + "name": "Weihnachtstag", + "date": "2023-12-25" + }, + { + "name": "Stephanstag", + "date": "2023-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_french.snap "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____fr______fr__.snap" similarity index 53% rename from tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_french.snap rename to "tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____fr______fr__.snap" index 5cb53af4e..f12ef11eb 100644 --- a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_french.snap +++ "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____fr______fr__.snap" @@ -1,38 +1,38 @@ [ { - "name": "Nouvel An", - "date": "2024-01-01" + "name": "Nouvel an", + "date": "2023-01-01" }, { - "name": "Saint-Berthold", - "date": "2024-01-02" + "name": "2 janvier", + "date": "2023-01-02" }, { "name": "Vendredi saint", - "date": "2024-03-29" + "date": "2023-04-07" }, { "name": "Lundi de P\u00e2ques", - "date": "2024-04-01" + "date": "2023-04-10" }, { "name": "Ascension", - "date": "2024-05-09" + "date": "2023-05-18" }, { "name": "Lundi de Pentec\u00f4te", - "date": "2024-05-20" + "date": "2023-05-29" }, { "name": "F\u00eate nationale", - "date": "2024-08-01" + "date": "2023-08-01" }, { "name": "No\u00ebl", - "date": "2024-12-25" + "date": "2023-12-25" }, { "name": "Saint-\u00c9tienne", - "date": "2024-12-26" + "date": "2023-12-26" } ] \ No newline at end of file diff --git "a/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____it______it__.snap" "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____it______it__.snap" new file mode 100644 index 000000000..348f0fdf8 --- /dev/null +++ "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____it______it__.snap" @@ -0,0 +1,38 @@ +[ + { + "name": "Capodanno", + "date": "2023-01-01" + }, + { + "name": "Giorno di Berchtold", + "date": "2023-01-02" + }, + { + "name": "Venerd\u00ec santo", + "date": "2023-04-07" + }, + { + "name": "Luned\u00ec di Pasqua", + "date": "2023-04-10" + }, + { + "name": "Ascensione", + "date": "2023-05-18" + }, + { + "name": "Glindesdi da Pentecosta", + "date": "2023-05-29" + }, + { + "name": "Festa nazionale", + "date": "2023-08-01" + }, + { + "name": "Natale", + "date": "2023-12-25" + }, + { + "name": "San Steffan", + "date": "2023-12-26" + } +] \ No newline at end of file diff --git "a/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____rm______rm__.snap" "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____rm______rm__.snap" new file mode 100644 index 000000000..b7ba4a112 --- /dev/null +++ "b/tests/.pest/snapshots/Countries/SwitzerlandTest/_supported_languages__\342\206\222_it_can_translate_swiss_holidays_into_with_data_set____rm______rm__.snap" @@ -0,0 +1,38 @@ +[ + { + "name": "Bun di bun onn", + "date": "2023-01-01" + }, + { + "name": "Bun di San Berchtold", + "date": "2023-01-02" + }, + { + "name": "Venerdi San", + "date": "2023-04-07" + }, + { + "name": "Lun di Pasca", + "date": "2023-04-10" + }, + { + "name": "Ascensiun", + "date": "2023-05-18" + }, + { + "name": "Lun di Pentecoste", + "date": "2023-05-29" + }, + { + "name": "Festa naziunala", + "date": "2023-08-01" + }, + { + "name": "Nadal", + "date": "2023-12-25" + }, + { + "name": "San Stefaun", + "date": "2023-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ag______ag__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ag______ag__.snap new file mode 100644 index 000000000..5cb7c3b58 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ag______ag__.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ai______ai__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ai______ai__.snap new file mode 100644 index 000000000..542a904bb --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ai______ai__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "Mauritiustag", + "date": "2024-09-22" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ar______ar__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ar______ar__.snap new file mode 100644 index 000000000..0f9a9e7a5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ar______ar__.snap @@ -0,0 +1,34 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_italian.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____be______be__.snap similarity index 55% rename from tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_italian.snap rename to tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____be______be__.snap index b40b5b698..5fb2185eb 100644 --- a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_translate_swiss_holidays_into_italian.snap +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____be______be__.snap @@ -1,38 +1,38 @@ [ { - "name": "Capodanno", + "name": "New Year's Day", "date": "2024-01-01" }, { - "name": "San Silvestro", + "name": "Berchtold's Day", "date": "2024-01-02" }, { - "name": "Venerd\u00ec Santo", + "name": "Good Friday", "date": "2024-03-29" }, { - "name": "Luned\u00ec di Pasqua", + "name": "Easter Monday", "date": "2024-04-01" }, { - "name": "Ascensione", + "name": "Ascension Day", "date": "2024-05-09" }, { - "name": "Luned\u00ec di Pentecoste", + "name": "Whit Monday", "date": "2024-05-20" }, { - "name": "Festa nazionale", + "name": "Swiss National Day", "date": "2024-08-01" }, { - "name": "Natale", + "name": "Christmas Day", "date": "2024-12-25" }, { - "name": "Santo Stefano", + "name": "St. Stephen's Day", "date": "2024-12-26" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bl______bl__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bl______bl__.snap new file mode 100644 index 000000000..6a33623a7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bl______bl__.snap @@ -0,0 +1,38 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bs______bs__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bs______bs__.snap new file mode 100644 index 000000000..6a33623a7 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____bs______bs__.snap @@ -0,0 +1,38 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____fr______fr__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____fr______fr__.snap new file mode 100644 index 000000000..94f00c1e2 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____fr______fr__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ge______ge__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ge______ge__.snap new file mode 100644 index 000000000..749ea44e5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ge______ge__.snap @@ -0,0 +1,38 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Je\u00fbne genevois", + "date": "2024-09-05" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "Restauration de la R\u00e9publique", + "date": "2024-12-31" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gl______gl__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gl______gl__.snap new file mode 100644 index 000000000..765fc8437 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gl______gl__.snap @@ -0,0 +1,46 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Fahrtsfest", + "date": "2024-04-04" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gr______gr__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gr______gr__.snap new file mode 100644 index 000000000..0f9a9e7a5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____gr______gr__.snap @@ -0,0 +1,34 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ju______ju__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ju______ju__.snap new file mode 100644 index 000000000..4b95c7f1d --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ju______ju__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Comm\u00e9moration du pl\u00e9biscite jurassien", + "date": "2024-06-23" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____lu______lu__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____lu______lu__.snap new file mode 100644 index 000000000..94f00c1e2 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____lu______lu__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ne______ne__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ne______ne__.snap new file mode 100644 index 000000000..5901af73b --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ne______ne__.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Establishment of the republic", + "date": "2024-03-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____nw______nw__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____nw______nw__.snap new file mode 100644 index 000000000..4b9998bac --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____nw______nw__.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ow______ow__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ow______ow__.snap new file mode 100644 index 000000000..8e777bf2f --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ow______ow__.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "St. Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sg______sg__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sg______sg__.snap new file mode 100644 index 000000000..cc31ce8c8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sg______sg__.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sh______sh__.snap similarity index 51% rename from tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap rename to tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sh______sh__.snap index f594ea470..dcc7f8946 100644 --- a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_get_swiss_holidays_for_a_specified_region__zh_.snap +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sh______sh__.snap @@ -1,42 +1,42 @@ [ { - "name": "Neujahr", + "name": "New Year's Day", "date": "2024-01-01" }, { - "name": "Karfreitag", + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", "date": "2024-03-29" }, { - "name": "Ostermontag", + "name": "Easter Monday", "date": "2024-04-01" }, { - "name": "Tag der Arbeit", + "name": "Labour Day", "date": "2024-05-01" }, { - "name": "Auffahrt", + "name": "Ascension Day", "date": "2024-05-09" }, { - "name": "Pfingstmontag", + "name": "Whit Monday", "date": "2024-05-20" }, { - "name": "Bundesfeier", + "name": "Swiss National Day", "date": "2024-08-01" }, { - "name": "Buss- und Bettag", - "date": "2024-09-15" - }, - { - "name": "Weihnachtstag", + "name": "Christmas Day", "date": "2024-12-25" }, { - "name": "Stephanstag", + "name": "St. Stephen's Day", "date": "2024-12-26" } ] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____so______so__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____so______so__.snap new file mode 100644 index 000000000..a47dffa22 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____so______so__.snap @@ -0,0 +1,50 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sz______sz__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sz______sz__.snap new file mode 100644 index 000000000..f35667027 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____sz______sz__.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Dreik\u00f6nigstag", + "date": "2024-01-06" + }, + { + "name": "St. Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____tg______tg__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____tg______tg__.snap new file mode 100644 index 000000000..dcc7f8946 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____tg______tg__.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ti______ti__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ti______ti__.snap new file mode 100644 index 000000000..3bd97ac05 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ti______ti__.snap @@ -0,0 +1,62 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Epifania", + "date": "2024-01-06" + }, + { + "name": "St. Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "San Pietro e Paolo", + "date": "2024-06-29" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ur______ur__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ur______ur__.snap new file mode 100644 index 000000000..f35667027 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____ur______ur__.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Dreik\u00f6nigstag", + "date": "2024-01-06" + }, + { + "name": "St. Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vd______vd__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vd______vd__.snap new file mode 100644 index 000000000..a701ef7ec --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vd______vd__.snap @@ -0,0 +1,34 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vs______vs__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vs______vs__.snap new file mode 100644 index 000000000..79b69e24d --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____vs______vs__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "St. Joseph's Day", + "date": "2024-03-19" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zg______zg__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zg______zg__.snap new file mode 100644 index 000000000..94f00c1e2 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zg______zg__.snap @@ -0,0 +1,54 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Corpus Christi", + "date": "2024-05-30" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Assumption Day", + "date": "2024-08-15" + }, + { + "name": "All Saints' Day", + "date": "2024-11-01" + }, + { + "name": "Immaculate Conception", + "date": "2024-12-08" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zh______zh__.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zh______zh__.snap new file mode 100644 index 000000000..dcc7f8946 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_holidays_for_a_specified_canton_with_data_set____zh______zh__.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Berchtold's Day", + "date": "2024-01-02" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Ascension Day", + "date": "2024-05-09" + }, + { + "name": "Whit Monday", + "date": "2024-05-20" + }, + { + "name": "Swiss National Day", + "date": "2024-08-01" + }, + { + "name": "Christmas Day", + "date": "2024-12-25" + }, + { + "name": "St. Stephen's Day", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_swiss_holidays.snap b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_swiss_holidays.snap index 96cd86c9b..5fb2185eb 100644 --- a/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_swiss_holidays.snap +++ b/tests/.pest/snapshots/Countries/SwitzerlandTest/it_can_calculate_swiss_holidays.snap @@ -1,38 +1,38 @@ [ { - "name": "Neujahr", + "name": "New Year's Day", "date": "2024-01-01" }, { - "name": "Berchtoldstag", + "name": "Berchtold's Day", "date": "2024-01-02" }, { - "name": "Karfreitag", + "name": "Good Friday", "date": "2024-03-29" }, { - "name": "Ostermontag", + "name": "Easter Monday", "date": "2024-04-01" }, { - "name": "Auffahrt", + "name": "Ascension Day", "date": "2024-05-09" }, { - "name": "Pfingstmontag", + "name": "Whit Monday", "date": "2024-05-20" }, { - "name": "Bundesfeier", + "name": "Swiss National Day", "date": "2024-08-01" }, { - "name": "Weihnachtstag", + "name": "Christmas Day", "date": "2024-12-25" }, { - "name": "Stephanstag", + "name": "St. Stephen's Day", "date": "2024-12-26" } ] \ No newline at end of file diff --git a/tests/Countries/SwitzerlandTest.php b/tests/Countries/SwitzerlandTest.php index 0e4a97f41..7395a8c15 100644 --- a/tests/Countries/SwitzerlandTest.php +++ b/tests/Countries/SwitzerlandTest.php @@ -7,6 +7,42 @@ use Spatie\Holidays\Exceptions\InvalidRegion; use Spatie\Holidays\Holidays; +dataset('cantons', [ + 'ag', + 'ai', + 'ar', + 'be', + 'bl', + 'bs', + 'fr', + 'ge', + 'gl', + 'gr', + 'ju', + 'lu', + 'ne', + 'nw', + 'ow', + 'sg', + 'sh', + 'so', + 'sz', + 'tg', + 'ti', + 'ur', + 'vd', + 'vs', + 'zg', + 'zh', +]); + +dataset('languages', [ + 'de', + 'fr', + 'it', + 'rm', +]); + it('can calculate swiss holidays', function () { CarbonImmutable::setTestNowAndTimezone('2024-01-01'); @@ -19,10 +55,10 @@ expect(formatDates($holidays))->toMatchSnapshot(); }); -it('can get swiss holidays for a specified region (zh)', function () { +it('can calculate holidays for a specified canton', function ($canton) { CarbonImmutable::setTestNowAndTimezone('2024-01-01'); - $switzerland = new Switzerland(region: 'ch-zh'); + $switzerland = new Switzerland(region: "ch-$canton"); $holidays = Holidays::for($switzerland)->get(); @@ -31,28 +67,127 @@ ->not()->toBeEmpty(); expect(formatDates($holidays))->toMatchSnapshot(); -}); +})->with('cantons'); it('throws an error when an invalid region is given', function () { - new Switzerland('ch-xx'); + $switzerland = new Switzerland('ch-xx'); + $holidays = Holidays::for($switzerland)->get(); + })->throws(InvalidRegion::class); -it('can translate swiss holidays into french', function () { - $holidays = Holidays::for(country: 'ch', locale: 'fr', year: 2024)->get(); +describe('supported languages', function () { + it('shares same translations keys in every language', function () { - expect($holidays) - ->toBeArray() - ->not()->toBeEmpty(); + $filePaths = __DIR__.'/../../lang/switzerland/**/holidays.json'; + $filePaths = glob($filePaths); - expect(formatDates($holidays))->toMatchSnapshot(); + $keysArray = []; + + foreach ($filePaths as $filePath) { + $content = file_get_contents($filePath); + $data = json_decode($content, true); + $keysArray[] = array_keys($data); + } + + // Compare keys of the first JSON file with the others + for ($i = 1; $i < count($keysArray); $i++) { + $diff = array_diff($keysArray[0], $keysArray[$i]); + if (! empty($diff)) { + + dump($filePaths[$i], $diff); + } + + expect($diff)->toBeEmpty(); + } + + }); + + it('can translate swiss holidays into', function (string $language) { + $holidays = Holidays::for(country: 'ch', locale: $language)->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); + })->with('languages'); + + it('does use native language for epiphany', function (string $canton, string $name, string $locale) { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $switzerland = new Switzerland("ch-$canton"); + $holidays = Holidays::for($switzerland, locale: $locale); + + expect($holidays->getName('2024-01-06'))->toBe($name); + })->with([ + ['sz', 'Dreikönigstag'], + ['ti', 'Epifania'], + ['ur', 'Dreikönigstag'], + ])->with('languages'); }); -it('can translate swiss holidays into italian', function () { - $holidays = Holidays::for(country: 'ch', locale: 'it', year: 2024)->get(); +it('does not have ephinay holiday at zh', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); - expect($holidays) - ->toBeArray() - ->not()->toBeEmpty(); + $switzerland = new Switzerland('ch-zh'); + $holidays = Holidays::for($switzerland); - expect(formatDates($holidays))->toMatchSnapshot(); + expect($holidays->isHoliday('2024-01-06'))->toBeFalse(); +}); + +describe('special holidays with conditions', function () { + + it('has holidays in on 12-26 if christmas is not on a monday or friday at', function (string $canton, int $year, bool $isHoliday) { + CarbonImmutable::setTestNowAndTimezone("$year-01-01"); + + $switzerland = new Switzerland("ch-$canton"); + $holidays = Holidays::for($switzerland); + + expect($holidays->isHoliday("$year-12-26"))->toBe($isHoliday); + }) + ->with(['ai', 'ar']) + ->with([ + [2017, false], + [2023, false], + [2024, true], + [2025, true], + [2026, false], + ]); + + it('has sets jeune genevois to thursday following the first sunday in september', function (int $year, string $date) { + CarbonImmutable::setTestNowAndTimezone("$year-01-01"); + + $switzerland = new Switzerland('ch-ge'); + $holidays = Holidays::for($switzerland); + + expect($holidays->isHoliday($date))->toBeTrue(); + }) + ->with([ + [2017, '2017-09-07'], + [2023, '2023-09-07'], + [2024, '2024-09-05'], + [2025, '2025-09-11'], + [2026, '2026-09-10'], + ]); }); + +it('celebrates labour day on 1st of may', function (string $canton) { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $switzerland = new Switzerland("ch-$canton"); + $holidays = Holidays::for($switzerland); + + expect($holidays->isHoliday('2024-05-01'))->toBeTrue(); +}) + ->with([ + 'zh', + 'so', + 'bs', + 'bl', + 'sh', + 'ag', + 'tg', + 'ne', + 'ju', + 'ti', + ]);