Annotation of embedaddon/php/ext/date/tests/DateTime_clone_basic2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test clone of objects whoose class derived from DateTime class
                      3: --FILE--
                      4: <?php
                      5: //Set the default time zone 
                      6: date_default_timezone_set("Europe/London");
                      7: 
                      8: class DateTimeExt1 extends DateTime {
                      9:        public $property1 = 99;
                     10:        public $property2 = "Hello";
                     11: 
                     12: }
                     13: 
                     14: class DateTimeExt2 extends DateTimeExt1 {
                     15:        public $property3 = true;
                     16:        public $property4 = 10.5;
                     17: }
                     18: 
                     19: echo "*** Testing clone on objects whoose class derived from DateTime class ***\n";
                     20: 
                     21: $d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
                     22: var_dump($d1);
                     23: $d1_clone = clone $d1;
                     24: var_dump($d1_clone);
                     25: 
                     26: $d2 = new DateTimeExt2("2009-02-03 12:34:41 GMT");
                     27: var_dump($d2);
                     28: $d2_clone = clone $d2;
                     29: var_dump($d2_clone);
                     30: ?>
                     31: ===DONE===
                     32: --EXPECTF--
                     33: *** Testing clone on objects whoose class derived from DateTime class ***
                     34: object(DateTimeExt1)#%d (5) {
                     35:   ["property1"]=>
                     36:   int(99)
                     37:   ["property2"]=>
                     38:   string(5) "Hello"
                     39:   ["date"]=>
                     40:   string(19) "2009-02-03 12:34:41"
                     41:   ["timezone_type"]=>
                     42:   int(2)
                     43:   ["timezone"]=>
                     44:   string(3) "GMT"
                     45: }
                     46: object(DateTimeExt1)#%d (5) {
                     47:   ["property1"]=>
                     48:   int(99)
                     49:   ["property2"]=>
                     50:   string(5) "Hello"
                     51:   ["date"]=>
                     52:   string(19) "2009-02-03 12:34:41"
                     53:   ["timezone_type"]=>
                     54:   int(2)
                     55:   ["timezone"]=>
                     56:   string(3) "GMT"
                     57: }
                     58: object(DateTimeExt2)#%d (7) {
                     59:   ["property3"]=>
                     60:   bool(true)
                     61:   ["property4"]=>
                     62:   float(10.5)
                     63:   ["property1"]=>
                     64:   int(99)
                     65:   ["property2"]=>
                     66:   string(5) "Hello"
                     67:   ["date"]=>
                     68:   string(19) "2009-02-03 12:34:41"
                     69:   ["timezone_type"]=>
                     70:   int(2)
                     71:   ["timezone"]=>
                     72:   string(3) "GMT"
                     73: }
                     74: object(DateTimeExt2)#%d (7) {
                     75:   ["property3"]=>
                     76:   bool(true)
                     77:   ["property4"]=>
                     78:   float(10.5)
                     79:   ["property1"]=>
                     80:   int(99)
                     81:   ["property2"]=>
                     82:   string(5) "Hello"
                     83:   ["date"]=>
                     84:   string(19) "2009-02-03 12:34:41"
                     85:   ["timezone_type"]=>
                     86:   int(2)
                     87:   ["timezone"]=>
                     88:   string(3) "GMT"
                     89: }
                     90: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>