kraghuba                Tue Jun 17 13:17:15 2008 UTC

  Modified files:              
    /php-src/ext/date/tests     date_add_basic.phpt 
  Log:
  Committed for Felix De Vliegher, TestFest Task No: 122, Tested on RHEL5, WinXP
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_add_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/date_add_basic.phpt
diff -u /dev/null php-src/ext/date/tests/date_add_basic.phpt:1.2
--- /dev/null   Tue Jun 17 13:17:15 2008
+++ php-src/ext/date/tests/date_add_basic.phpt  Tue Jun 17 13:17:15 2008
@@ -0,0 +1,46 @@
+--TEST--
+Test date_add() function : basic functionality 
+--CREDITS--
+Felix De Vliegher <[EMAIL PROTECTED]>
+--SKIPIF--
+<?php if (!function_exists('date_add')) echo "skip: date_add() function not 
found!"; ?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+/* Prototype  : void date_add(DateTime object, DateInterval interval)
+ * Description: Adds an interval to the current date in object.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing date_add() : basic functionality ***\n";
+
+// Initialise all required variables
+$startDate = '2008-01-01 12:25';
+$format = 'Y-m-d H:i:s';
+$intervals = array(
+       'P3Y6M4DT12H30M5S',
+       'P0D',
+       'P2DT1M',
+       'P1Y2MT23H43M150S'
+);
+
+$d = new DateTime($startDate);
+var_dump( $d->format($format) );
+
+foreach($intervals as $interval) {
+       date_add($d, new DateInterval($interval) );
+       var_dump( $d->format($format) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_add() : basic functionality ***
+unicode(19) "2008-01-01 12:25:00"
+unicode(19) "2011-07-06 00:55:05"
+unicode(19) "2011-07-06 00:55:05"
+unicode(19) "2011-07-08 00:56:05"
+unicode(19) "2012-09-09 00:41:35"
+===DONE===



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to