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
1 parent
82267a8
commit 5411dc7
Showing
3 changed files
with
86 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,38 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Uzbekistan extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'uz'; | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Yangi yil' => '01-01', | ||
'Xalqaro xotin-qizlar kuni' => '03-08', | ||
'Navro\'z' => '03-21', | ||
'Xotira va qadrlash kuni' => '05-09', | ||
'Mustaqillik kuni' => '09-01', | ||
'Ustoz va murabbiylar kuni' => '10-01', | ||
'Konstitutsiya kuni' => '12-08', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$easter = CarbonImmutable::createFromTimestamp(easter_date($year)) | ||
->setTimezone('Asia/Tashkent'); | ||
|
||
return [ | ||
//'Ramazon Hayiti' (Eid al-Fitr) and 'Qurbon Hayiti' (Eid al-Adha) will be added after the implementation of Islamic holidays | ||
]; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/.pest/snapshots/Countries/UzbekistanTest/it_can_calculate_uzbekistan_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,30 @@ | ||
[ | ||
{ | ||
"name": "Yangi yil", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "Xalqaro xotin-qizlar kuni", | ||
"date": "2024-03-08" | ||
}, | ||
{ | ||
"name": "Navro'z", | ||
"date": "2024-03-21" | ||
}, | ||
{ | ||
"name": "Xotira va qadrlash kuni", | ||
"date": "2024-05-09" | ||
}, | ||
{ | ||
"name": "Mustaqillik kuni", | ||
"date": "2024-09-01" | ||
}, | ||
{ | ||
"name": "Ustoz va murabbiylar kuni", | ||
"date": "2024-10-01" | ||
}, | ||
{ | ||
"name": "Konstitutsiya kuni", | ||
"date": "2024-12-08" | ||
} | ||
] |
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 uzbekistan holidays', function () { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'uz')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |