Annotation of embedaddon/php/ext/date/tests/DateTime_serialize.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test serialization of DateTime objects
! 3: --FILE--
! 4: <?php
! 5: //Set the default time zone
! 6: date_default_timezone_set("Europe/London");
! 7:
! 8: $date1 = new DateTime("2005-07-14 22:30:41");
! 9: var_dump($date1);
! 10: $serialized = serialize($date1);
! 11: var_dump($serialized);
! 12:
! 13: $date2 = unserialize($serialized);
! 14: var_dump($date2);
! 15: // Try to use unserialzied object
! 16: var_dump( $date2->format( "F j, Y, g:i a") );
! 17:
! 18: ?>
! 19: ===DONE===
! 20: --EXPECTF--
! 21: object(DateTime)#%d (3) {
! 22: ["date"]=>
! 23: string(19) "2005-07-14 22:30:41"
! 24: ["timezone_type"]=>
! 25: int(3)
! 26: ["timezone"]=>
! 27: string(13) "Europe/London"
! 28: }
! 29: string(118) "O:8:"DateTime":3:{s:4:"date";s:19:"2005-07-14 22:30:41";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}"
! 30: object(DateTime)#%d (3) {
! 31: ["date"]=>
! 32: string(19) "2005-07-14 22:30:41"
! 33: ["timezone_type"]=>
! 34: int(3)
! 35: ["timezone"]=>
! 36: string(13) "Europe/London"
! 37: }
! 38: string(23) "July 14, 2005, 10:30 pm"
! 39: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>