com php-src: Add test for bug #52480: ext/date/tests/bug52480.phpt

From: Date: Thu, 22 Jun 2017 12:56:03 +0000
Subject: com php-src: Add test for bug #52480: ext/date/tests/bug52480.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98165@lists.php.net to get a copy of this message
Commit: 9437dcd621b326d23babe7fe93ebb984aac79e6a Author: Michael Moussa <michael.moussa@gmail.com> Thu, 25 May 2017 19:21:00 -0400 Committer: Joe Watkins <krakjoe@php.net> Thu, 22 Jun 2017 13:56:03 +0100 Parents: 2030b59829a6a16f0cefe2c3e4d1b9feed080b42 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9437dcd621b326d23babe7fe93ebb984aac79e6a Log: Add test for bug #52480 Bugs: https://bugs.php.net/52480 Changed paths: A ext/date/tests/bug52480.phpt Diff: diff --git a/ext/date/tests/bug52480.phpt b/ext/date/tests/bug52480.phpt new file mode 100644 index 0000000...907a545 --- /dev/null +++ b/ext/date/tests/bug52480.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #52480 (Incorrect difference using DateInterval) +--XFAIL-- +See https://bugs.php.net/bug.php?id=52480 +--FILE-- +<?php + +$expectedDiff = (array) new DateInterval('P30D'); + +// If the DateInterval object was created by DateTime::diff(), then this is the total +// number of days between the start and end dates. Otherwise, days will be FALSE. +// https://secure.php.net/manual/en/class.dateinterval.php +$expectedDiff['days'] = 30; + +foreach (DateTimeZone::listIdentifiers() as $timezone) { + $start = new DateTime('2017-03-01', new DateTimeZone($timezone)); + $end = new DateTime('2017-03-31', new DateTimeZone($timezone)); + + if ($expectedDiff != (array) $start->diff($end)) { + echo "\nWrong result for $timezone!\n"; + } +} +?> +===DONE=== +--EXPECT-- +===DONE===

« previous php.cvs (#98165) next »