xref: /PHP-5.5/ext/date/tests/DateTime_verify.phpt (revision 23ab2575)
1--TEST--
2Test DateTime class registration
3--FILE--
4<?php
5
6echo "*** Verify DateTime class ***\n";
7
8echo "Verify DateTime class registered OK\n";
9$class = new ReflectionClass('DateTime');
10var_dump($class);
11
12echo "..and get names of all its methods\n";
13$methods = $class->getMethods();
14var_dump($methods);
15
16echo "..and get names of all its class constants\n";
17$constants = $class->getConstants();
18var_dump($constants);
19
20?>
21===DONE===
22--EXPECTF--
23*** Verify DateTime class ***
24Verify DateTime class registered OK
25object(ReflectionClass)#%d (1) {
26  ["name"]=>
27  string(8) "DateTime"
28}
29..and get names of all its methods
30array(18) {
31  [0]=>
32  &object(ReflectionMethod)#%d (2) {
33    ["name"]=>
34    string(11) "__construct"
35    ["class"]=>
36    string(8) "DateTime"
37  }
38  [1]=>
39  &object(ReflectionMethod)#%d (2) {
40    ["name"]=>
41    string(8) "__wakeup"
42    ["class"]=>
43    string(8) "DateTime"
44  }
45  [2]=>
46  &object(ReflectionMethod)#%d (2) {
47    ["name"]=>
48    string(11) "__set_state"
49    ["class"]=>
50    string(8) "DateTime"
51  }
52  [3]=>
53  &object(ReflectionMethod)#%d (2) {
54    ["name"]=>
55    string(16) "createFromFormat"
56    ["class"]=>
57    string(8) "DateTime"
58  }
59  [4]=>
60  &object(ReflectionMethod)#%d (2) {
61    ["name"]=>
62    string(13) "getLastErrors"
63    ["class"]=>
64    string(8) "DateTime"
65  }
66  [5]=>
67  &object(ReflectionMethod)#%d (2) {
68    ["name"]=>
69    string(6) "format"
70    ["class"]=>
71    string(8) "DateTime"
72  }
73  [6]=>
74  &object(ReflectionMethod)#%d (2) {
75    ["name"]=>
76    string(6) "modify"
77    ["class"]=>
78    string(8) "DateTime"
79  }
80  [7]=>
81  &object(ReflectionMethod)#%d (2) {
82    ["name"]=>
83    string(3) "add"
84    ["class"]=>
85    string(8) "DateTime"
86  }
87  [8]=>
88  &object(ReflectionMethod)#%d (2) {
89    ["name"]=>
90    string(3) "sub"
91    ["class"]=>
92    string(8) "DateTime"
93  }
94  [9]=>
95  &object(ReflectionMethod)#%d (2) {
96    ["name"]=>
97    string(11) "getTimezone"
98    ["class"]=>
99    string(8) "DateTime"
100  }
101  [10]=>
102  &object(ReflectionMethod)#%d (2) {
103    ["name"]=>
104    string(11) "setTimezone"
105    ["class"]=>
106    string(8) "DateTime"
107  }
108  [11]=>
109  &object(ReflectionMethod)#%d (2) {
110    ["name"]=>
111    string(9) "getOffset"
112    ["class"]=>
113    string(8) "DateTime"
114  }
115  [12]=>
116  &object(ReflectionMethod)#%d (2) {
117    ["name"]=>
118    string(7) "setTime"
119    ["class"]=>
120    string(8) "DateTime"
121  }
122  [13]=>
123  &object(ReflectionMethod)#%d (2) {
124    ["name"]=>
125    string(7) "setDate"
126    ["class"]=>
127    string(8) "DateTime"
128  }
129  [14]=>
130  &object(ReflectionMethod)#%d (2) {
131    ["name"]=>
132    string(10) "setISODate"
133    ["class"]=>
134    string(8) "DateTime"
135  }
136  [15]=>
137  &object(ReflectionMethod)#%d (2) {
138    ["name"]=>
139    string(12) "setTimestamp"
140    ["class"]=>
141    string(8) "DateTime"
142  }
143  [16]=>
144  &object(ReflectionMethod)#%d (2) {
145    ["name"]=>
146    string(12) "getTimestamp"
147    ["class"]=>
148    string(8) "DateTime"
149  }
150  [17]=>
151  &object(ReflectionMethod)#%d (2) {
152    ["name"]=>
153    string(4) "diff"
154    ["class"]=>
155    string(8) "DateTime"
156  }
157}
158..and get names of all its class constants
159array(11) {
160  ["ATOM"]=>
161  string(13) "Y-m-d\TH:i:sP"
162  ["COOKIE"]=>
163  string(16) "l, d-M-Y H:i:s T"
164  ["ISO8601"]=>
165  string(13) "Y-m-d\TH:i:sO"
166  ["RFC822"]=>
167  string(16) "D, d M y H:i:s O"
168  ["RFC850"]=>
169  string(16) "l, d-M-y H:i:s T"
170  ["RFC1036"]=>
171  string(16) "D, d M y H:i:s O"
172  ["RFC1123"]=>
173  string(16) "D, d M Y H:i:s O"
174  ["RFC2822"]=>
175  string(16) "D, d M Y H:i:s O"
176  ["RFC3339"]=>
177  string(13) "Y-m-d\TH:i:sP"
178  ["RSS"]=>
179  string(16) "D, d M Y H:i:s O"
180  ["W3C"]=>
181  string(13) "Y-m-d\TH:i:sP"
182}
183===DONE===
184