xref: /PHP-8.0/ext/date/tests/bug78055.phpt (revision 4e8a6554)
1--TEST--
2Bug #78055 (DatePeriod's getRecurrences and ->recurrences don't match)
3--FILE--
4<?php
5$start = new DateTime('2018-12-31 00:00:00');
6$end   = new DateTime('2021-12-31 00:00:00');
7$interval = new DateInterval('P1M');
8$recurrences = 5;
9
10$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
11echo $period->getRecurrences(), " ", $period->recurrences, "\n";
12
13$period = new DatePeriod($start, $interval, $recurrences);
14echo $period->getRecurrences(), " ", $period->recurrences, "\n";
15
16$period = new DatePeriod($start, $interval, $end);
17echo $period->getRecurrences(), " ", $period->recurrences, "\n";
18
19$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
20echo $period->getRecurrences(), " ", $period->recurrences, "\n";
21?>
22--EXPECT--
235 5
245 6
25 1
26 0
27