-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix strange behavior of PHP easter_date function
- Loading branch information
Showing
3 changed files
with
42 additions
and
26 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
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,33 @@ | ||
<?php | ||
|
||
namespace Nati\Businesscal\Test\Unit; | ||
|
||
use Nati\Businesscal\ChristianCalendar; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ChristianCalendarTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function canReturnEasterDateBasedHolidayWhateverTZ() | ||
{ | ||
//The purpose of this test is to fix strange behavior of easter_date PHP function | ||
|
||
putenv('TZ=UTC'); | ||
$this->assertEquals('18/05', (new ChristianCalendar())->getAscensionDay(2023)->format('d/m')); | ||
|
||
putenv('TZ=Europe/Paris'); | ||
$this->assertEquals('18/05', (new ChristianCalendar())->getAscensionDay(2023)->format('d/m')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canReturnEasterDateBasedHolidayEvenInDistantFuture() | ||
{ | ||
//The purpose of this test is to fix strange behavior of easter_date PHP function | ||
|
||
$this->assertEquals('18/05', (new ChristianCalendar())->getAscensionDay(2045)->format('d/m')); | ||
} | ||
} |