1--TEST-- 2Test 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 13date_default_timezone_set("Europe/London"); 14 15echo "*** Testing date_offset_get() : error conditions ***\n"; 16 17echo "\n-- Testing date_offset_get() function with zero arguments --\n"; 18var_dump( date_offset_get() ); 19 20echo "\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; 23var_dump( date_offset_get($datetime, $extra_arg) ); 24 25echo "\n-- Testing date_offset_get() function with an invalid values for \$object argument --\n"; 26$invalid_obj = new stdClass(); 27var_dump( date_offset_get($invalid_obj) ); 28$invalid_obj = 10; 29var_dump( date_offset_get($invalid_obj) ); 30$invalid_obj = null; 31var_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 39Warning: date_offset_get() expects exactly 1 parameter, 0 given in %s on line %d 40bool(false) 41 42-- Testing date_offset_get() function with more than expected no. of arguments -- 43 44Warning: date_offset_get() expects exactly 1 parameter, 2 given in %s on line %d 45bool(false) 46 47-- Testing date_offset_get() function with an invalid values for $object argument -- 48 49Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d 50bool(false) 51 52Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d 53bool(false) 54 55Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d 56bool(false) 57===DONE=== 58