Annotation of embedaddon/php/ext/date/tests/DateTimeZone_getOffset_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test DateTimeZone::getOffset() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
! 6: * Description: Returns the timezone offset from GMT
! 7: * Source code: ext/date/php_date.c
! 8: * Alias to functions: timezone_offset_get()
! 9: */
! 10:
! 11: //Set the default time zone
! 12: date_default_timezone_set("GMT");
! 13:
! 14: $tz = new DateTimeZone("Europe/London");
! 15: $date = date_create("GMT");
! 16:
! 17: echo "*** Testing DateTimeZone::getOffset() : error conditions ***\n";
! 18:
! 19: echo "\n-- Testing DateTimeZone::getOffset() function with zero arguments --\n";
! 20: var_dump( $tz->getOffset() );
! 21:
! 22: echo "\n-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --\n";
! 23: $extra_arg = 99;
! 24: var_dump( $tz->getOffset($date, $extra_arg) );
! 25:
! 26: ?>
! 27: ===DONE===
! 28: --EXPECTF--
! 29: *** Testing DateTimeZone::getOffset() : error conditions ***
! 30:
! 31: -- Testing DateTimeZone::getOffset() function with zero arguments --
! 32:
! 33: Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 0 given in %s on line %d
! 34: bool(false)
! 35:
! 36: -- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --
! 37:
! 38: Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 2 given in %s on line %d
! 39: bool(false)
! 40: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>