1--TEST--
2Test that DatePeriod::__set_state() can be called directly
3--FILE--
4<?php
5
6$period = DatePeriod::__set_state(
7    [
8        "start" => new DateTime("2022-07-14 12:00:00", new DateTimeZone("UTC")),
9        "end" => new DateTime("2022-07-16 12:00:00", new DateTimeZone("UTC")),
10        "current" => null,
11        "interval" => new DateInterval('P2D'),
12        "recurrences" => 2,
13        "include_start_date" => false,
14        "include_end_date" => true,
15    ]
16);
17
18var_dump($period);
19
20?>
21--EXPECTF--
22object(DatePeriod)#%d (%d) {
23  ["start"]=>
24  object(DateTime)#%d (%d) {
25    ["date"]=>
26    string(26) "2022-07-14 12:00:00.000000"
27    ["timezone_type"]=>
28    int(3)
29    ["timezone"]=>
30    string(3) "UTC"
31  }
32  ["current"]=>
33  NULL
34  ["end"]=>
35  object(DateTime)#%d (%d) {
36    ["date"]=>
37    string(26) "2022-07-16 12:00:00.000000"
38    ["timezone_type"]=>
39    int(3)
40    ["timezone"]=>
41    string(3) "UTC"
42  }
43  ["interval"]=>
44  object(DateInterval)#%d (%d) {
45    ["y"]=>
46    int(0)
47    ["m"]=>
48    int(0)
49    ["d"]=>
50    int(2)
51    ["h"]=>
52    int(0)
53    ["i"]=>
54    int(0)
55    ["s"]=>
56    int(0)
57    ["f"]=>
58    float(0)
59    ["invert"]=>
60    int(0)
61    ["days"]=>
62    bool(false)
63    ["from_string"]=>
64    bool(false)
65  }
66  ["recurrences"]=>
67  int(2)
68  ["include_start_date"]=>
69  bool(false)
70  ["include_end_date"]=>
71  bool(true)
72}
73