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