Annotation of embedaddon/php/ext/standard/tests/url/get_headers_error_002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test get_headers() function: wrong type for argument format
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: $url = 'http://php.net';
16:
17: // Format argument as type String
18: echo "\n-- Testing get_headers() function with format argument as type string --\n";
19: var_dump( get_headers($url, "#PHPTestFest2009 Norway") );
20:
21: // Format argument as type Array
22: echo "\n-- Testing get_headers() function with format argument as type array --\n";
23: var_dump( get_headers($url, array()) );
24:
25: // Format argument as type Object
26: class testObject
27: {
28: }
29:
30: $object = new testObject();
31: echo "\n-- Testing get_headers() function with format argument as type object --\n";
32: var_dump( get_headers($url, $object) );
33:
34:
35: echo "Done"
36: ?>
37: --EXPECTF--
38: *** Testing get_headers() : error conditions ***
39:
40: -- Testing get_headers() function with format argument as type string --
41:
42: Warning: get_headers() expects parameter 2 to be long, string given in %s on line 13
43: NULL
44:
45: -- Testing get_headers() function with format argument as type array --
46:
47: Warning: get_headers() expects parameter 2 to be long, array given in %s on line 17
48: NULL
49:
50: -- Testing get_headers() function with format argument as type object --
51:
52: Warning: get_headers() expects parameter 2 to be long, object given in %s on line 26
53: NULL
54: Done
55:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>