DateTime_verify.phpt 3.5 KB

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