xref: /php-src/ext/date/tests/bug75167.phpt (revision 091c0920)
1--TEST--
2Bug #75167 (DateTime::add does only care about backward DST transition, not forward)
3--FILE--
4<?php
5$tz = new DateTimeZone('Europe/London'); // A timezone that has DST
6
7$five_hours_interval = new DateInterval('PT5H');
8
9$date = new DateTime("2014-3-30 00:00:00", $tz);
10
11// Add five hours and subtract 5 hours. The $newDate should then equal the date.
12$five_hours_later = (clone $date)->add($five_hours_interval);
13$newDate = (clone $five_hours_later)->sub($five_hours_interval);
14
15echo $date->format('c') . "\n";
16echo $newDate->format('c');
17?>
18--EXPECT--
192014-03-30T00:00:00+00:00
202014-03-30T00:00:00+00:00
21