Fix flaky DatePeriod test

$start and $end use the H:i:s from the current time. If $end happens on
a second boundary, $start + 4 days will include $end, thus performing an
extra iteration. Fix this by setting H:i:s to 00:00:00.
This commit is contained in:
Ilija Tovilo 2025-03-06 15:01:30 +01:00
parent dc6586dd9d
commit 8a699372f2
No known key found for this signature in database
GPG key ID: 5050C66BFCD1015A

View file

@ -3,8 +3,8 @@ Date Period iterators do not advance on valid()
--FILE--
<?php
$start = DateTime::createFromFormat('Y-m-d', '2022-01-01');
$end = DateTime::createFromFormat('Y-m-d', '2022-01-04');
$start = DateTime::createFromFormat('Y-m-d H:i:s', '2022-01-01 00:00:00');
$end = DateTime::createFromFormat('Y-m-d H:i:s', '2022-01-04 00:00:00');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($start, $interval, $end);
$iterator = $period->getIterator();