generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
abdalrhman ak
committed
Feb 4, 2024
1 parent
6b35af7
commit 9f7561b
Showing
5 changed files
with
198 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,16 @@ | ||
{ | ||
"New Year\n's Day": "يوم رأس السنة", | ||
"Mother\n's Day": "عيد الأم", | ||
"Teacher\n's Day": "عيد المعلم", | ||
"Western Easter": "عيد الفصح الغربي", | ||
"Eid al-Fitr": "عيد الفطر السعيد", | ||
"Syrian Independence Day": "عيد الجلا واستقلال سورية", | ||
"Labor Day": "عيد العمال", | ||
"Eastern Easter": "عيد الفصح الشرقي", | ||
"Martyrs\n's Day": "عيد الشهداء", | ||
"Eid al-Adha": "عيد الأضحى المبارك", | ||
"Islamic New Year": "عيد رأس السنة الهجرية", | ||
"The commemoration of the birth of the Prophet Muhammad": "عيد مولد الرسول الأعظم", | ||
"The October Liberation War": "ذكرى حرب تشرين التحريرية", | ||
"Merry Christmas": "عيد الميلاد المجيد" | ||
} |
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,40 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Syria extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'sy'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'New Year\'s Day' => '01-01', | ||
'Mother\'s Day' => '03-21', | ||
'Teacher\'s Day' => '03-21', | ||
'Western Easter' => '03-31', | ||
'Eid al-Fitr' => '04-10', | ||
'Syrian Independence Day' => '04-17', | ||
'Labor Day' => '05-01', | ||
'Eastern Easter' => '05-05', | ||
'Martyrs\'s Day' => '05-06', | ||
'Eid al-Adha' => '06-16', | ||
'Islamic New Year' => '07-07', | ||
'The commemoration of the birth of the Prophet Muhammad' => '09-15', | ||
'The October Liberation War' => '10-06', | ||
'Merry Christmas' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, string|CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
// The variable holidays all follow the lunar calendar, so their dates are not confirmed. | ||
return []; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_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,58 @@ | ||
[ | ||
{ | ||
"name": "New Year's Day", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Mother's Day", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "Teacher's Day", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "Western Easter", | ||
"date": "2024-03-31" | ||
}, | ||
{ | ||
"name": "Eid al-Fitr", | ||
"date": "2024-04-10" | ||
}, | ||
{ | ||
"name": "Syrian Independence Day", | ||
"date": "2024-04-17" | ||
}, | ||
{ | ||
"name": "Labor Day", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "Eastern Easter", | ||
"date": "2024-05-05" | ||
}, | ||
{ | ||
"name": "Martyrs's Day", | ||
"date": "2024-05-06" | ||
}, | ||
{ | ||
"name": "Eid al-Adha", | ||
"date": "2024-06-16" | ||
}, | ||
{ | ||
"name": "Islamic New Year", | ||
"date": "2024-07-07" | ||
}, | ||
{ | ||
"name": "The commemoration of the birth of the Prophet Muhammad", | ||
"date": "2024-09-15" | ||
}, | ||
{ | ||
"name": "The October Liberation War", | ||
"date": "2024-10-06" | ||
}, | ||
{ | ||
"name": "Merry Christmas", | ||
"date": "2024-12-25" | ||
} | ||
] |
58 changes: 58 additions & 0 deletions
58
tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.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,58 @@ | ||
[ | ||
{ | ||
"name": "New Year's Day", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Mother's Day", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "Teacher's Day", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u063a\u0631\u0628\u064a", | ||
"date": "2024-03-31" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u0633\u0639\u064a\u062f", | ||
"date": "2024-04-10" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u062c\u0644\u0627 \u0648\u0627\u0633\u062a\u0642\u0644\u0627\u0644 \u0633\u0648\u0631\u064a\u0629", | ||
"date": "2024-04-17" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0639\u0645\u0627\u0644", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u0634\u0631\u0642\u064a", | ||
"date": "2024-05-05" | ||
}, | ||
{ | ||
"name": "Martyrs's Day", | ||
"date": "2024-05-06" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u0645\u0628\u0627\u0631\u0643", | ||
"date": "2024-06-16" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0631\u0623\u0633 \u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0647\u062c\u0631\u064a\u0629", | ||
"date": "2024-07-07" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0645\u0648\u0644\u062f \u0627\u0644\u0631\u0633\u0648\u0644 \u0627\u0644\u0623\u0639\u0638\u0645", | ||
"date": "2024-09-15" | ||
}, | ||
{ | ||
"name": "\u0630\u0643\u0631\u0649 \u062d\u0631\u0628 \u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062a\u062d\u0631\u064a\u0631\u064a\u0629", | ||
"date": "2024-10-06" | ||
}, | ||
{ | ||
"name": "\u0639\u064a\u062f \u0627\u0644\u0645\u064a\u0644\u0627\u062f \u0627\u0644\u0645\u062c\u064a\u062f", | ||
"date": "2024-12-25" | ||
} | ||
] |
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,26 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Tests\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Holidays; | ||
|
||
it('can calculate syria holidays', function () { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'sy')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty() | ||
->and(formatDates($holidays))->toMatchSnapshot(); | ||
}); | ||
it('can translate syria holidays into arabic', function () { | ||
$holidays = Holidays::for(country: 'sy', locale: 'ar', year: 2024)->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |