Annotation of embedaddon/php/ext/date/tests/DateTimeZone_construct_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test new DateTimeZone() : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : DateTimeZone::__construct ( string $timezone )
! 6: * Description: Returns new DateTimeZone 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 DateTimeZone() : error conditions ***\n";
! 14:
! 15: echo "\n-- Testing new DateTimeZone() with more than expected no. of arguments --\n";
! 16: $timezone = "GMT";
! 17: $extra_arg = 99;
! 18: var_dump( new DateTimeZone($timezone, $extra_arg) );
! 19:
! 20: ?>
! 21: ===DONE===
! 22: --EXPECTF--
! 23: *** Testing DateTimeZone() : error conditions ***
! 24:
! 25: -- Testing new DateTimeZone() with more than expected no. of arguments --
! 26:
! 27: Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 2 given' in %s:%d
! 28: Stack trace:
! 29: #0 %s(%d): DateTimeZone->__construct('GMT', 99)
! 30: #1 {main}
! 31: thrown in %s on line %d
! 32:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>