-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
bafa1b5
commit 5eb0c3c
Showing
2 changed files
with
57 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
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 @@ | ||
<?php | ||
|
||
namespace Tests\Cmixin\Calendar; | ||
|
||
use Cmixin\BusinessDay\Calendar\HijriCalendar; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class HijriCalendarTest extends TestCase | ||
{ | ||
/** @dataProvider getDates */ | ||
public function testHolidaysSpecificDates(string $hijri, string $gregorian): void | ||
{ | ||
$calendar = new HijriCalendar(); | ||
[$year, $month, $day] = explode('-', $hijri); | ||
$date = $calendar->getDate($year, $month, $day); | ||
|
||
self::assertSame($gregorian, implode('-', $date)); | ||
} | ||
|
||
public static function getDates(): array | ||
{ | ||
$tests = [ | ||
['1428-12-10', '2007-12-20'], | ||
['1429-12-10', '2008-12-9'], // some converters give 2008-12-8 | ||
['1430-12-10', '2009-11-28'], // some converters give 2009-11-27 | ||
]; | ||
|
||
return array_combine(array_column($tests, 0), $tests); | ||
} | ||
} |