Skip to content

Commit fb2700b

Browse files
committed
Fix flaky timezone test fixture (GH-18624)
As documented in [RunningTests], tests have to be written to be independent of any php.ini file. Without specifying the timezone, the var_dump() will make use of the default timezone that may not be the expected "UTC" timezone. This renders the test-cases flaky and will make them fail if the `date.timezone` is different from the string "UTC". Fix is to interpolate the timezone in the test fixture or to set `date.timezone` to `UTC`. [RunningTests]: docs/source/miscellaneous/running-tests.rst fix-up-of: GH-18624
1 parent 57d9b20 commit fb2700b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/date/tests/multiple_calls_date_period_iterator_current.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Multiple calls to DatePeriod iterator current() leak objects
33
--FILE--
44
<?php
5-
$start = new DateTime('2018-12-31 00:00:00');
6-
$end = new DateTime('2019-12-31 00:00:00');
5+
$start = new DateTime('2018-12-31 00:00:00 UTC');
6+
$end = new DateTime('2019-12-31 00:00:00 UTC');
77

88
$interval = new DateInterval('P1M');
99
$period = new DatePeriod($start, $interval, 1);

0 commit comments

Comments
 (0)