cvs: pear /Date/tests/bugs bug-13376.phpt
[email protected] ("Firman Wandayandi") Sat, 10 May 2008 07:40:44 -0000
| Newsgroups | php.pear.cvs |
|---|---|
| Message-ID | <cvsfirman1210405244@cvsserver> |
firman Sat May 10 07:40:44 2008 UTC
Modified files:
/pear/Date/tests/bugs bug-13376.phpt
Log:
Change the date, add the time and add the diff output to test
http://cvs.php.net/viewvc.cgi/pear/Date/tests/bugs/bug-13376.phpt?r1=1.1&r2=1.2&diff_format=u
Index: pear/Date/tests/bugs/bug-13376.phpt
diff -u pear/Date/tests/bugs/bug-13376.phpt:1.1 pear/Date/tests/bugs/bug-13376.phpt:1.2
--- pear/Date/tests/bugs/bug-13376.phpt:1.1 Fri Mar 21 10:50:49 2008
+++ pear/Date/tests/bugs/bug-13376.phpt Sat May 10 07:40:44 2008
@@ -1,20 +1,32 @@
--TEST--
-Bug #13376 setFromDateDiff change source dates
+Bug #13376 setFromDateDiff change the source of Date objects
--FILE--
<?php
+/*
+ * Test for: Date_Span
+ * Part tested: Date_Span::setFromDateDiff()
+ *
+ * This test should be tested on both PHP4 and PHP5 to see the different.
+ *
+ * $Id: bug-13376.phpt,v 1.2 2008/05/10 07:40:44 firman Exp $
+ */
require_once 'Date.php';
-$startDate = new Date( "2008-02-12" );
-$endDate = new Date( "2008-03-01" );
-print "Days: " . $startDate->format( "%Y-%m-%d" ) . " to " .
-$endDate->format( "%Y-%m-%d" ) . "\n";
+$startDate = new Date('2008-02-29 00:00:00');
+$endDate = new Date('2008-03-01 23:30:10');
+print 'Days: ' . $startDate->format('%Y-%m-%d') . ' to ' . $endDate->format( '%Y-%m-%d') . "\n";
+
$diff = new Date_Span();
-$diff->setFromDateDiff( $startDate, $endDate );
-print "Days: " . $startDate->format( "%Y-%m-%d" ) . " to " .
-$endDate->format( "%Y-%m-%d" ) . "\n";
+$diff->setFromDateDiff($startDate, $endDate);
+
+// still same instances?
+print 'Days: ' . $startDate->format('%Y-%m-%d') . ' to ' . $endDate->format('%Y-%m-%d') . "\n";
+// what about diff?
+print 'Diff: ' . $diff->format('%D day %H hours %M minutes %S seconds') . "\n";
?>
--EXPECT--
-Days: 2008-02-12 to 2008-03-01
-Days: 2008-02-12 to 2008-03-01
+Days: 2008-02-29 to 2008-03-01
+Days: 2008-02-29 to 2008-03-01
+Diff: 1 day 23 hours 30 minutes 10 seconds