1--TEST--
2Tests for DateTimeImmutable::createFromInterface inheritance
3--INI--
4date.timezone=Europe/London
5--FILE--
6<?php
7class MyDateTimeImmutable extends DateTimeImmutable {}
8
9$current = "2014-03-02 16:24:08";
10
11$i = MyDateTimeImmutable::createFromInterface( date_create( $current ) );
12var_dump( $i );
13
14$i = MyDateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
15var_dump( $i );
16
17$current = "2019-12-16 15:06:46 CET";
18
19$i = MyDateTimeImmutable::createFromInterface( date_create( $current ) );
20var_dump( $i );
21
22$i = MyDateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
23var_dump( $i );
24
25$current = "2019-12-16 15:08:20 +0100";
26
27$i = MyDateTimeImmutable::createFromInterface( date_create( $current ) );
28var_dump( $i );
29
30$i = MyDateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
31var_dump( $i );
32?>
33--EXPECTF--
34object(MyDateTimeImmutable)#%d (3) {
35  ["date"]=>
36  string(26) "2014-03-02 16:24:08.000000"
37  ["timezone_type"]=>
38  int(3)
39  ["timezone"]=>
40  string(13) "Europe/London"
41}
42object(MyDateTimeImmutable)#%d (3) {
43  ["date"]=>
44  string(26) "2014-03-02 16:24:08.000000"
45  ["timezone_type"]=>
46  int(3)
47  ["timezone"]=>
48  string(13) "Europe/London"
49}
50object(MyDateTimeImmutable)#%d (3) {
51  ["date"]=>
52  string(26) "2019-12-16 15:06:46.000000"
53  ["timezone_type"]=>
54  int(2)
55  ["timezone"]=>
56  string(3) "CET"
57}
58object(MyDateTimeImmutable)#%d (3) {
59  ["date"]=>
60  string(26) "2019-12-16 15:06:46.000000"
61  ["timezone_type"]=>
62  int(2)
63  ["timezone"]=>
64  string(3) "CET"
65}
66object(MyDateTimeImmutable)#%d (3) {
67  ["date"]=>
68  string(26) "2019-12-16 15:08:20.000000"
69  ["timezone_type"]=>
70  int(1)
71  ["timezone"]=>
72  string(6) "+01:00"
73}
74object(MyDateTimeImmutable)#%d (3) {
75  ["date"]=>
76  string(26) "2019-12-16 15:08:20.000000"
77  ["timezone_type"]=>
78  int(1)
79  ["timezone"]=>
80  string(6) "+01:00"
81}
82