Annotation of embedaddon/php/ext/date/tests/date_offset_get_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test date_offset_get() function : error conditions
! 3: --FILE--
! 4: <?php
! 5:
! 6: /* Prototype : int date_offset_get ( DateTime $object )
! 7: * Description: Returns the daylight saving time offset
! 8: * Source code: ext/date/php_date.c
! 9: * Alias to functions: DateTime::getOffset
! 10: */
! 11:
! 12: //Set the default time zone
! 13: date_default_timezone_set("Europe/London");
! 14:
! 15: echo "*** Testing date_offset_get() : error conditions ***\n";
! 16:
! 17: echo "\n-- Testing date_offset_get() function with zero arguments --\n";
! 18: var_dump( date_offset_get() );
! 19:
! 20: echo "\n-- Testing date_offset_get() function with more than expected no. of arguments --\n";
! 21: $datetime = date_create("2009-01-30 19:34:10");
! 22: $extra_arg = 30;
! 23: var_dump( date_offset_get($datetime, $extra_arg) );
! 24:
! 25: echo "\n-- Testing date_offset_get() function with an invalid values for \$object argument --\n";
! 26: $invalid_obj = new stdClass();
! 27: var_dump( date_offset_get($invalid_obj) );
! 28: $invalid_obj = 10;
! 29: var_dump( date_offset_get($invalid_obj) );
! 30: $invalid_obj = null;
! 31: var_dump( date_offset_get($invalid_obj) );
! 32: ?>
! 33: ===DONE===
! 34: --EXPECTF--
! 35: *** Testing date_offset_get() : error conditions ***
! 36:
! 37: -- Testing date_offset_get() function with zero arguments --
! 38:
! 39: Warning: date_offset_get() expects exactly 1 parameter, 0 given in %s on line %d
! 40: bool(false)
! 41:
! 42: -- Testing date_offset_get() function with more than expected no. of arguments --
! 43:
! 44: Warning: date_offset_get() expects exactly 1 parameter, 2 given in %s on line %d
! 45: bool(false)
! 46:
! 47: -- Testing date_offset_get() function with an invalid values for $object argument --
! 48:
! 49: Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
! 50: bool(false)
! 51:
! 52: Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
! 53: bool(false)
! 54:
! 55: Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
! 56: bool(false)
! 57: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>