1--TEST-- 2Test get_headers() function : error conditions - wrong number of args 3--CREDITS-- 4June Henriksen <juneih@redpill-linpro.com> 5#PHPTestFest2009 Norway 2009-06-09 \o/ 6--FILE-- 7<?php 8/* Prototype : proto array get_headers(string url[, int format]) 9 * Description: Fetches all the headers sent by the server in response to a HTTP request 10 * Source code: ext/standard/url.c 11 * Alias to functions: 12 */ 13 14echo "*** Testing get_headers() : error conditions ***\n"; 15 16// Zero arguments 17echo "\n-- Testing get_headers() function with Zero arguments --\n"; 18var_dump( get_headers() ); 19 20//Test get_headers with one more than the expected number of arguments 21echo "\n-- Testing get_headers() function with more than expected no. of arguments --\n"; 22$url = 'string_val'; 23$format = 1; 24$extra_arg = 10; 25var_dump( get_headers($url, $format, $extra_arg) ); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing get_headers() : error conditions *** 31 32-- Testing get_headers() function with Zero arguments -- 33 34Warning: get_headers() expects at least 1 parameter, 0 given in %s on line 12 35NULL 36 37-- Testing get_headers() function with more than expected no. of arguments -- 38 39Warning: get_headers() expects at most 2 parameters, 3 given in %s on line 19 40NULL 41Done 42 43 44 45