Annotation of embedaddon/php/ext/standard/tests/general_functions/get_resource_type_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test get_resource_type() function : usage variations - different data types as handle arg
3: --FILE--
4: <?php
5: /* Prototype : string get_resource_type ( resource $handle )
6: * Description: Returns the resource type
7: * Source code: Zend/zend_builtin_functions.c
8: */
9:
10: echo "*** Testing get_resource_type() : variation test ***\n";
11:
12: class Hello {
13: public function SayHello($arg) {
14: echo "Hello\n";
15: }
16: }
17:
18: $res = fopen(__FILE__, "r");
19:
20: $vars = array(
21: "bool"=>true,
22: "int 10"=>10,
23: "float 10.5"=>10.5,
24: "string"=>"Hello World",
25: "array"=>array(1,2,3,4,5),
26: "NULL"=>NULL,
27: "Object"=>new Hello()
28: );
29:
30: foreach($vars as $variation =>$object) {
31: echo "\n-- $variation --\n";
32: var_dump(get_resource_type($object));
33: };
34:
35: ?>
36: ===DONE===
37: --EXPECTF--
38: *** Testing get_resource_type() : variation test ***
39:
40: -- bool --
41:
42: Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d
43: NULL
44:
45: -- int 10 --
46:
47: Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d
48: NULL
49:
50: -- float 10.5 --
51:
52: Warning: get_resource_type() expects parameter 1 to be resource, double given in %s on line %d
53: NULL
54:
55: -- string --
56:
57: Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
58: NULL
59:
60: -- array --
61:
62: Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d
63: NULL
64:
65: -- NULL --
66:
67: Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d
68: NULL
69:
70: -- Object --
71:
72: Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d
73: NULL
74: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>