generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added Pakistan as the country * Added tests for country Pakistan * removed doc block * Added Urdu translations * Update tests/Countries/PakistanTest.php Co-authored-by: Niels Vanpachtenbeke <[email protected]> --------- Co-authored-by: Niels Vanpachtenbeke <[email protected]>
- Loading branch information
1 parent
fdd5779
commit 7b15433
Showing
4 changed files
with
84 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,8 @@ | ||
{ | ||
"Kashmir Solidarity Day": "یوم یکجہتی کشمیر", | ||
"Pakistan Day": "یوم پاکستان", | ||
"Labour Day": "مزدورں کادن", | ||
"Independence Day": "یوم آزادی", | ||
"Iqbal Day": "یوم اقبال", | ||
"Quaid-e-Azam 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,32 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Pakistan extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'pk'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Kashmir Solidarity Day' => '02-05', | ||
'Pakistan Day' => '03-23', | ||
'Labour Day' => '05-01', | ||
'Independence Day' => '08-14', | ||
'Iqbal Day' => '11-09', | ||
'Quaid-e-Azam Day' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
// The variable holidays are all follow lunar calendar so their dates are not confirmed. | ||
return []; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/.pest/snapshots/Countries/PakistanTest/it_can_calculate_pakistan_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,26 @@ | ||
[ | ||
{ | ||
"name": "Kashmir Solidarity Day", | ||
"date": "2024-02-05" | ||
}, | ||
{ | ||
"name": "Pakistan Day", | ||
"date": "2024-03-23" | ||
}, | ||
{ | ||
"name": "Labour Day", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "Independence Day", | ||
"date": "2024-08-14" | ||
}, | ||
{ | ||
"name": "Iqbal Day", | ||
"date": "2024-11-09" | ||
}, | ||
{ | ||
"name": "Quaid-e-Azam Day", | ||
"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,18 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Tests\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Holidays; | ||
|
||
it('can calculate pakistan holidays', function () { | ||
CarbonImmutable::setTestNow('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'pk')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |