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
Showing
3 changed files
with
101 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,37 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Azerbaijan extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'az'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Yeni il' => '01-01', | ||
'Beynəlxalq Qadınlar günü' => '03-08', | ||
'Novruz bayramı' => '03-20', | ||
'Faşizm üzərində qələbə günü' => '05-09', | ||
'Müstəqillik Günü' => '05-28', | ||
'Azərbaycan xalqının milli qurtuluş günü' => '06-15', | ||
'Azərbaycan Respublikasının Silahlı Qüvvələri günü' => '06-26', | ||
'Müstəqilliyin bərpası günü' => '10-18', | ||
'Zəfər Günü' => '11-08', | ||
'Azərbaycan Respublikasının Dövlət bayrağı günü' => '11-09', | ||
'Dünya azərbaycanlılarının həmrəyliyi günü' => '12-31', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
// does not change according to the standard | ||
return []; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/.pest/snapshots/Countries/AzerbaijanTest/it_can_calculate_azerbaijani_holidays.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[ | ||
{ | ||
"name": "Yeni il", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Beyn\u0259lxalq Qad\u0131nlar g\u00fcn\u00fc", | ||
"date": "2024-03-08" | ||
}, | ||
{ | ||
"name": "Novruz bayram\u0131", | ||
"date": "2024-03-20" | ||
}, | ||
{ | ||
"name": "Fa\u015fizm \u00fcz\u0259rind\u0259 q\u0259l\u0259b\u0259 g\u00fcn\u00fc", | ||
"date": "2024-05-09" | ||
}, | ||
{ | ||
"name": "M\u00fcst\u0259qillik G\u00fcn\u00fc", | ||
"date": "2024-05-28" | ||
}, | ||
{ | ||
"name": "Az\u0259rbaycan xalq\u0131n\u0131n milli qurtulu\u015f g\u00fcn\u00fc", | ||
"date": "2024-06-15" | ||
}, | ||
{ | ||
"name": "Az\u0259rbaycan Respublikas\u0131n\u0131n Silahl\u0131 Q\u00fcvv\u0259l\u0259ri g\u00fcn\u00fc", | ||
"date": "2024-06-26" | ||
}, | ||
{ | ||
"name": "M\u00fcst\u0259qilliyin b\u0259rpas\u0131 g\u00fcn\u00fc", | ||
"date": "2024-10-18" | ||
}, | ||
{ | ||
"name": "Z\u0259f\u0259r G\u00fcn\u00fc", | ||
"date": "2024-11-08" | ||
}, | ||
{ | ||
"name": "Az\u0259rbaycan Respublikas\u0131n\u0131n D\u00f6vl\u0259t bayra\u011f\u0131 g\u00fcn\u00fc", | ||
"date": "2024-11-09" | ||
}, | ||
{ | ||
"name": "D\u00fcnya az\u0259rbaycanl\u0131lar\u0131n\u0131n h\u0259mr\u0259yliyi g\u00fcn\u00fc", | ||
"date": "2024-12-31" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Tests\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Holidays; | ||
|
||
it('can calculate azerbaijani holidays', function () { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'az')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |