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

1.1       misho       1: --TEST--
                      2: Test new DateTime() : error conditions 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : DateTime::__construct  ([ string $time="now"  [, DateTimeZone $timezone=NULL  ]] )
                      6:  * Description: Returns new DateTime object
                      7:  * Source code: ext/date/php_date.c
                      8:  * Alias to functions: 
                      9:  */
                     10: //Set the default time zone 
                     11: date_default_timezone_set("GMT");
                     12: 
                     13: echo "*** Testing date_create() : error conditions ***\n";
                     14: 
                     15: echo "\n-- Testing new DateTime() with more than expected no. of arguments --\n";
                     16: $time = "GMT";
                     17: $timezone  = timezone_open("GMT");
                     18: $extra_arg = 99;
                     19: var_dump( new DateTime($time, $timezone, $extra_arg) );
                     20: 
                     21: ?>
                     22: ===DONE===
                     23: --EXPECTF--
                     24: *** Testing date_create() : error conditions ***
                     25: 
                     26: -- Testing new DateTime() with more than expected no. of arguments --
                     27: 
                     28: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects at most 2 parameters, 3 given' in %s:%d
                     29: Stack trace:
                     30: #0 %s(%d): DateTime->__construct('GMT', Object(DateTimeZone), 99)
                     31: #1 {main}
                     32:   thrown in %s on line %d

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