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[, resource $context]]) 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$context = stream_context_get_default(); 25$extra_arg = 10; 26var_dump( get_headers($url, $format, $context, $extra_arg) ); 27 28echo "Done"; 29?> 30--EXPECTF-- 31*** Testing get_headers() : error conditions *** 32 33-- Testing get_headers() function with Zero arguments -- 34 35Warning: get_headers() expects at least 1 parameter, 0 given in %s on line 12 36NULL 37 38-- Testing get_headers() function with more than expected no. of arguments -- 39 40Warning: get_headers() expects at most 3 parameters, 4 given in %s on line 20 41NULL 42Done 43