generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ariful Alam <[email protected]>
- Loading branch information
Showing
3 changed files
with
87 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,35 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Bangladesh extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'bd'; | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'International Mother Language Day' => '02-21', | ||
'Birthday of Sheikh Mujibur Rahman' => '03-17', | ||
'Independence Day' => '03-26', | ||
'Bengali New Year' => '04-14', | ||
'May Day' => '05-01', | ||
'National Mourning Day' => '08-15', | ||
'Victory Day' => '12-16', | ||
'Christmas Day' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
// The variable holidays all follow the lunar calendar, so their dates are not confirmed. | ||
return []; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/.pest/snapshots/Countries/BangladeshTest/it_can_calculate_bangladesh_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,34 @@ | ||
[ | ||
{ | ||
"name": "International Mother Language Day", | ||
"date": "2024-02-21" | ||
}, | ||
{ | ||
"name": "Birthday of Sheikh Mujibur Rahman", | ||
"date": "2024-03-17" | ||
}, | ||
{ | ||
"name": "Independence Day", | ||
"date": "2024-03-26" | ||
}, | ||
{ | ||
"name": "Bengali New Year", | ||
"date": "2024-04-14" | ||
}, | ||
{ | ||
"name": "May Day", | ||
"date": "2024-05-01" | ||
}, | ||
{ | ||
"name": "National Mourning Day", | ||
"date": "2024-08-15" | ||
}, | ||
{ | ||
"name": "Victory Day", | ||
"date": "2024-12-16" | ||
}, | ||
{ | ||
"name": "Christmas 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 bangladesh holidays', function () { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | ||
|
||
$holidays = Holidays::for(country: 'bd')->get(); | ||
|
||
expect($holidays) | ||
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); | ||
}); |