Annotation of embedaddon/php/ext/date/tests/DateTime_setTime_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test DateTime::setTime() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
! 6: * Description: Resets the current time of the DateTime object to a different time.
! 7: * Source code: ext/date/php_date.c
! 8: * Alias to functions: date_time_set
! 9: */
! 10:
! 11: //Set the default time zone
! 12: date_default_timezone_set("Europe/London");
! 13:
! 14: echo "*** Testing DateTime::setTime() : basic functionality ***\n";
! 15:
! 16: // Create a DateTime object
! 17: $datetime = new DateTime("2009-01-31 15:14:10");
! 18:
! 19: echo "Initial date: " . $datetime ->format(DATE_RFC2822) . "\n";
! 20:
! 21: $datetime->setTime(17, 20);
! 22: echo "After modification1 " . $datetime ->format(DATE_RFC2822) . "\n";
! 23:
! 24: $datetime->setTime(19, 05, 59);
! 25: echo "After modification2 " . $datetime ->format(DATE_RFC2822) . "\n";
! 26:
! 27: $datetime->setTime(24, 10);
! 28: echo "After modification3 " . $datetime ->format(DATE_RFC2822) . "\n";
! 29:
! 30: $datetime->setTime(47, 35, 47);
! 31: echo "After modification4 " . $datetime ->format(DATE_RFC2822) . "\n";
! 32:
! 33: $datetime->setTime(54, 25);
! 34: echo "After modification5 " . $datetime ->format(DATE_RFC2822) . "\n";
! 35:
! 36: ?>
! 37: ===DONE===
! 38: --EXPECTF--
! 39: *** Testing DateTime::setTime() : basic functionality ***
! 40: Initial date: Sat, 31 Jan 2009 15:14:10 +0000
! 41: After modification1 Sat, 31 Jan 2009 17:20:00 +0000
! 42: After modification2 Sat, 31 Jan 2009 19:05:59 +0000
! 43: After modification3 Sun, 01 Feb 2009 00:10:00 +0000
! 44: After modification4 Mon, 02 Feb 2009 23:35:47 +0000
! 45: After modification5 Wed, 04 Feb 2009 06:25:00 +0000
! 46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>