Annotation of embedaddon/php/ext/date/tests/oo_001.phpt, revision 1.1.1.1

1.1       misho       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:        }
                      9: }
                     10: class _t extends DateTimeZone {
                     11:        function __construct() {
                     12:        }
                     13: }
                     14: 
                     15: $d = new DateTime;
                     16: var_dump($d->format("Y-m-d H:i:s"));
                     17: 
                     18: $d = new _d;
                     19: var_dump($d->format("Y-m-d H:i:s"));
                     20: 
                     21: try {
                     22:        new DateTime("1am todax");
                     23: } catch (Exception $e) {
                     24:        echo $e->getMessage(),"\n";
                     25: }
                     26: 
                     27: $t = new DateTimeZone("UTC");
                     28: var_dump($t->getName());
                     29: 
                     30: $t = new _t;
                     31: var_dump($t->getName());
                     32: 
                     33: try {
                     34:        new DateTimeZone("GottaFindThisOne");
                     35: } catch (Exception $e) {
                     36:        echo $e->getMessage(),"\n";
                     37: }
                     38: 
                     39: echo "DONE\n";
                     40: ?>
                     41: --EXPECTF--
                     42: string(19) "%d-%d-%d %d:%d:%d"
                     43: 
                     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"
                     48: 
                     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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>