Annotation of embedaddon/php/ext/date/tests/bug55253.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #55253 (DateTime::add() and sub() result -1 hour on objects with time zone type 2)
! 3: --CREDITS--
! 4: Daniel Convissor <danielc@php.net>
! 5: --FILE--
! 6: <?php
! 7:
! 8: date_default_timezone_set('America/New_York');
! 9:
! 10: $interval = new DateInterval('PT2H1M');
! 11:
! 12: $date3 = new DateTime('2010-10-04 02:18:48');
! 13: $date2 = new DateTime('2010-10-04 02:18:48 EDT');
! 14:
! 15: echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
! 16: echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
! 17:
! 18: echo $interval->format('Add %h hours %i minutes') . "\n";
! 19: $date3->add($interval);
! 20: $date2->add($interval);
! 21:
! 22: echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
! 23: echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
! 24:
! 25: // Try subtracting from expected result.
! 26: $date3 = new DateTime('2010-10-04 04:19:48');
! 27: $date2 = new DateTime('2010-10-04 04:19:48 EDT');
! 28:
! 29: echo $interval->format('Subtract %h hours %i minutes from expected') . "\n";
! 30: $date3->sub($interval);
! 31: $date2->sub($interval);
! 32:
! 33: echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
! 34: echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
! 35:
! 36: ?>
! 37: --EXPECT--
! 38: Zone Type 3: 2010-10-04 02:18:48 EDT
! 39: Zone Type 2: 2010-10-04 02:18:48 EDT
! 40: Add 2 hours 1 minutes
! 41: Zone Type 3: 2010-10-04 04:19:48 EDT
! 42: Zone Type 2: 2010-10-04 04:19:48 EDT
! 43: Subtract 2 hours 1 minutes from expected
! 44: Zone Type 3: 2010-10-04 02:18:48 EDT
! 45: Zone Type 2: 2010-10-04 02:18:48 EDT
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>