1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/date/tests/bug78055.phpt
Ilija Tovilo 4e8a6554cb Fix failing date test
INCLUDE_END_DATE has only been introduced in PHP 8.2.
2022-10-20 10:48:57 +02:00

31 lines
977 B
PHP

--TEST--
Bug #78055 (DatePeriod's getRecurrences and ->recurrences don't match)
--FILE--
<?php
$start = new DateTime('2018-12-31 00:00:00');
$end = new DateTime('2021-12-31 00:00:00');
$interval = new DateInterval('P1M');
$recurrences = 5;
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
echo $period->getRecurrences(), " ", $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $recurrences);
echo $period->getRecurrences(), " ", $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::INCLUDE_END_DATE);
echo $period->getRecurrences(), " ", $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $end);
echo $period->getRecurrences(), " ", $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
echo $period->getRecurrences(), " ", $period->recurrences, "\n";
?>
--EXPECT--
5 5
5 6
5 7
1
0