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