Exemplo n.º 1
0
 public function testFromOneDayOfYearFactoryMethodRespectsDistanceBetweenDays()
 {
     $this->forAll(Generator\choose(2000, 2020), Generator\choose(1, 365), Generator\choose(1, 365))->then(function ($year, $dayOfYear, $anotherDayOfYear) {
         $day = UTCDateTime::fromOneBasedDayOfYear($year, $dayOfYear);
         $anotherDay = UTCDateTime::fromOneBasedDayOfYear($year, $anotherDayOfYear);
         $this->assertEquals(abs($dayOfYear - $anotherDayOfYear) * 86400, abs($day->differenceInSeconds($anotherDay)), "Days of the year {$year}: {$dayOfYear}, {$anotherDayOfYear}" . PHP_EOL . "{$day->toIso8601()}, {$anotherDay->toIso8601()}");
     });
 }