xref: /PHP-7.1/ext/date/tests/oo_002.phpt (revision 8ac4d119)
1--TEST--
2date OO cloning
3--FILE--
4<?php
5date_default_timezone_set('Europe/Berlin');
6class _d extends DateTime {}
7class _t extends DateTimeZone {}
8$d = new _d("1pm Aug 1 GMT 2007");
9var_dump($d->format(DateTime::RFC822));
10$c = clone $d;
11var_dump($c->format(DateTime::RFC822));
12$d->modify("1 hour");
13$c->modify("1 second ago");
14var_dump($d->format(DateTime::RFC822));
15var_dump($c->format(DateTime::RFC822));
16$t = new _t("Asia/Tokyo");
17var_dump($t->getName());
18$c = clone $t;
19var_dump($c->getName());
20?>
21--EXPECT--
22string(29) "Wed, 01 Aug 07 13:00:00 +0000"
23string(29) "Wed, 01 Aug 07 13:00:00 +0000"
24string(29) "Wed, 01 Aug 07 14:00:00 +0000"
25string(29) "Wed, 01 Aug 07 12:59:59 +0000"
26string(10) "Asia/Tokyo"
27string(10) "Asia/Tokyo"
28