kraghuba Tue Jun 17 13:18:09 2008 UTC Modified files: /php-src/ext/date/tests date_sub_basic.phpt Log: Committed for Felix De Vliegher, TestFest Task No: 123, Tested on RHEL5-32bit, WinXP http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_sub_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/date_sub_basic.phpt diff -u /dev/null php-src/ext/date/tests/date_sub_basic.phpt:1.2 --- /dev/null Tue Jun 17 13:18:09 2008 +++ php-src/ext/date/tests/date_sub_basic.phpt Tue Jun 17 13:18:08 2008 @@ -0,0 +1,46 @@ +--TEST-- +Test date_sub() function : basic functionality +--CREDITS-- +Felix De Vliegher <[EMAIL PROTECTED]> +--SKIPIF-- +<?php if (!function_exists('date_sub')) echo "skip: date_sub() function not found!"; ?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +/* Prototype : void date_sub(DateTime object, DateInterval interval) + * Description: Subtracts an interval from the current date in object. + * Source code: ext/date/php_date.c + * Alias to functions: + */ + +echo "*** Testing date_sub() : 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_sub($d, new DateInterval($interval) ); + var_dump( $d->format($format) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing date_sub() : basic functionality *** +unicode(19) "2008-01-01 12:25:00" +unicode(19) "2004-06-26 23:54:55" +unicode(19) "2004-06-26 23:54:55" +unicode(19) "2004-06-24 23:53:55" +unicode(19) "2003-04-24 00:08:25" +===DONE===
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php