generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add National and Revolutionary Iran Holidays #146
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
933de85
Add Iran Holidays
alisalehi1380 b380d2d
Merge branch 'main' of https://github.com/spatie/holidays
alisalehi1380 66bea7c
Add(lang): Iran Holidays
alisalehi1380 e4d2ecd
Fix(Countries): remove `variableHolidays` func | rename Iran Holidays…
alisalehi1380 a146daa
Add(test): can calculate iran holidays in local | Change setTestNowAn…
alisalehi1380 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,12 @@ | ||
{ | ||
"پیروزی انقلاب اسلامی پنجاه و هفت": "Anniversary of Islamic Revolution Day", | ||
"روز ملی شدن صنعت نفت": "Nationalization of Oil Industry Day", | ||
"نخستین روز نوروز": "Nowruz First Day", | ||
"دومین روز نوروز": "Nowruz Second Day", | ||
"سومین روز نوروز": "Nowruz Third Day", | ||
"چهارمین روز نوروز": "Nowruz Fourth Day", | ||
"روز جمهوری اسلامی": "Islamic Republic Day", | ||
"سیزده بدر": "Sizdah Bedar", | ||
"رحلت روح\u200Cالله خمینی": "Death of Khomeini Day", | ||
"قیام ۱۵ خرداد": "Revolt of Khordad 15 Day" | ||
} |
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,12 @@ | ||
{ | ||
"پیروزی انقلاب اسلامی پنجاه و هفت": "پیروزی انقلاب اسلامی پنجاه و هفت", | ||
"روز ملی شدن صنعت نفت": "روز ملی شدن صنعت نفت", | ||
"نخستین روز نوروز": "نخستین روز نوروز", | ||
"دومین روز نوروز": "دومین روز نوروز", | ||
"سومین روز نوروز": "سومین روز نوروز", | ||
"چهارمین روز نوروز": "چهارمین روز نوروز", | ||
"روز جمهوری اسلامی": "روز جمهوری اسلامی", | ||
"سیزده بدر": "سیزده بدر", | ||
"رحلت روح\u200Cالله خمینی": "رحلت روح\u200Cالله خمینی", | ||
"قیام ۱۵ خرداد": "قیام ۱۵ خرداد" | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Iran extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'ir'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return [ | ||
'پیروزی انقلاب اسلامی پنجاه و هفت' => '02-11', | ||
'روز ملی شدن صنعت نفت' => '03-19', | ||
'نخستین روز نوروز' => '03-20', | ||
'دومین روز نوروز' => '03-21', | ||
'سومین روز نوروز' => '03-22', | ||
'چهارمین روز نوروز' => '03-23', | ||
'روز جمهوری اسلامی' => '03-31', | ||
'سیزده بدر' => '04-01', | ||
'رحلت روحالله خمینی' => '06-03', | ||
'قیام ۱۵ خرداد' => '06-04', | ||
]; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/.pest/snapshots/Countries/IranTest/it_can_calculate_iran_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,42 @@ | ||
[ | ||
{ | ||
"name": "\u067e\u06cc\u0631\u0648\u0632\u06cc \u0627\u0646\u0642\u0644\u0627\u0628 \u0627\u0633\u0644\u0627\u0645\u06cc \u067e\u0646\u062c\u0627\u0647 \u0648 \u0647\u0641\u062a", | ||
"date": "2024-02-11" | ||
}, | ||
{ | ||
"name": "\u0631\u0648\u0632 \u0645\u0644\u06cc \u0634\u062f\u0646 \u0635\u0646\u0639\u062a \u0646\u0641\u062a", | ||
"date": "2024-03-19" | ||
}, | ||
{ | ||
"name": "\u0646\u062e\u0633\u062a\u06cc\u0646 \u0631\u0648\u0632 \u0646\u0648\u0631\u0648\u0632", | ||
"date": "2024-03-20" | ||
}, | ||
{ | ||
"name": "\u062f\u0648\u0645\u06cc\u0646 \u0631\u0648\u0632 \u0646\u0648\u0631\u0648\u0632", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "\u0633\u0648\u0645\u06cc\u0646 \u0631\u0648\u0632 \u0646\u0648\u0631\u0648\u0632", | ||
"date": "2024-03-22" | ||
}, | ||
{ | ||
"name": "\u0686\u0647\u0627\u0631\u0645\u06cc\u0646 \u0631\u0648\u0632 \u0646\u0648\u0631\u0648\u0632", | ||
"date": "2024-03-23" | ||
}, | ||
{ | ||
"name": "\u0631\u0648\u0632 \u062c\u0645\u0647\u0648\u0631\u06cc \u0627\u0633\u0644\u0627\u0645\u06cc", | ||
"date": "2024-03-31" | ||
}, | ||
{ | ||
"name": "\u0633\u06cc\u0632\u062f\u0647 \u0628\u062f\u0631", | ||
"date": "2024-04-01" | ||
}, | ||
{ | ||
"name": "\u0631\u062d\u0644\u062a \u0631\u0648\u062d\u200c\u0627\u0644\u0644\u0647 \u062e\u0645\u06cc\u0646\u06cc", | ||
"date": "2024-06-03" | ||
}, | ||
{ | ||
"name": "\u0642\u06cc\u0627\u0645 \u06f1\u06f5 \u062e\u0631\u062f\u0627\u062f", | ||
"date": "2024-06-04" | ||
} | ||
] |
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,31 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Tests\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Holidays; | ||
|
||
it('can calculate iran holidays', function () { | ||
CarbonImmutable::setTestNow('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'ir')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); | ||
|
||
it('can calculate iran holidays in local', function (string $locale, string $newYearsDayName) { | ||
CarbonImmutable::setTestNow('2024-01-01'); | ||
$result = Holidays::for(country: 'ir', year: null, locale: $locale)->get(); | ||
|
||
expect($result)->toBeArray(); | ||
expect($result[7]['name'])->toBe($newYearsDayName); | ||
})->with( | ||
[ | ||
['en', 'Sizdah Bedar'], | ||
['fa', 'سیزده بدر'], | ||
] | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the 7th date of the holidays array because it is far from any political and ethnic front. 🤝