Return to get_headers_error_001.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / url |
1.1 misho 1: --TEST-- 2: Test get_headers() function : error conditions - wrong number of args 3: --CREDITS-- 4: June 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: 14: echo "*** Testing get_headers() : error conditions ***\n"; 15: 16: // Zero arguments 17: echo "\n-- Testing get_headers() function with Zero arguments --\n"; 18: var_dump( get_headers() ); 19: 20: //Test get_headers with one more than the expected number of arguments 21: echo "\n-- Testing get_headers() function with more than expected no. of arguments --\n"; 22: $url = 'string_val'; 23: $format = 1; 24: $extra_arg = 10; 25: var_dump( get_headers($url, $format, $extra_arg) ); 26: 27: echo "Done"; 28: ?> 29: --EXPECTF-- 30: *** Testing get_headers() : error conditions *** 31: 32: -- Testing get_headers() function with Zero arguments -- 33: 34: Warning: get_headers() expects at least 1 parameter, 0 given in %s on line 12 35: NULL 36: 37: -- Testing get_headers() function with more than expected no. of arguments -- 38: 39: Warning: get_headers() expects at most 2 parameters, 3 given in %s on line 19 40: NULL 41: Done 42: 43: 44: