Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / date / tests / oo_001.phpt
blob7cbf847c528b6cea6eed176b31ae94f4e6f270d3
1 --TEST--
2 date OO interface
3 --FILE--
4 <?php
5 date_default_timezone_set('UTC');
6 class _d extends DateTime {
7         function __construct() {
8         }
10 class _t extends DateTimeZone {
11         function __construct() {
12         }
15 $d = new DateTime;
16 var_dump($d->format("Y-m-d H:i:s"));
18 $d = new _d;
19 var_dump($d->format("Y-m-d H:i:s"));
21 try {
22         new DateTime("1am todax");
23 } catch (Exception $e) {
24         echo $e->getMessage(),"\n";
27 $t = new DateTimeZone("UTC");
28 var_dump($t->getName());
30 $t = new _t;
31 var_dump($t->getName());
33 try {
34         new DateTimeZone("GottaFindThisOne");
35 } catch (Exception $e) {
36         echo $e->getMessage(),"\n";
39 echo "DONE\n";
41 --EXPECTF--
42 string(19) "%d-%d-%d %d:%d:%d"
44 Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d
45 bool(false)
46 DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database
47 string(3) "UTC"
49 Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d
50 bool(false)
51 DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne)
52 DONE