/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/date/tests/bug80047.phpt
39 строк
825 B
Derick Rethans
Fixed bug #80047 (DatePeriod doesn't warn with custom DateTimeImmutable)
28 июл 2022, 12:28
28 июл 2022, 12:28
001e7db
Код
Авторство
О чём код?
--TEST-- Bug #80047: DatePeriod doesn't support custom DateTimeImmutable --INI-- date.timezone=UTC --FILE-- <?php class CustomDateTime extends DateTime {} class CustomDateTimeImmutable extends DateTimeImmutable {} $dt = new DateTime('2022-06-24'); $dti = new DateTimeImmutable('2022-06-24'); $cdt = new CustomDateTime('2022-06-25'); $cdti = new CustomDateTimeImmutable('2022-06-25'); $i = new DateInterval('P1D'); $tests = [ [ $dt, $i, $cdt ], [ $cdt, $i, $dt ], [ $cdt, $i, $cdt ], [ $dti, $i, $cdti ], [ $cdti, $i, $dti ], [ $cdti, $i, $cdti ], [ $cdt, $i, $cdti ], ]; foreach ($tests as $test) { $dp = new DatePeriod(...$test); foreach ($dp as $date) {} echo get_class($date), "\n"; } ?> --EXPECT-- DateTime DateTime DateTime DateTimeImmutable DateTimeImmutable DateTimeImmutable DateTimeImmutable