summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/get_resource_type_variation1.phpt
blob: 635bd898164f0773cc4ce0126fddb79e2ac48046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--TEST--
Test get_resource_type() function : usage variations - different data types as handle arg
--FILE--
<?php
/* Prototype  : string get_resource_type  ( resource $handle  )
 * Description:  Returns the resource type 
 * Source code: Zend/zend_builtin_functions.c
 */		

echo "*** Testing get_resource_type() : variation test ***\n";

class Hello {
  public function SayHello($arg) {
  	echo "Hello\n";
  } 
}

$res = fopen(__FILE__, "r");

$vars = array(
	"bool"=>true,
	"int 10"=>10,
	"float 10.5"=>10.5,
	"string"=>"Hello World",
	"array"=>array(1,2,3,4,5),
	"NULL"=>NULL,
	"Object"=>new Hello()
);

foreach($vars as $variation =>$object) {
      echo "\n-- $variation --\n";
      var_dump(get_resource_type($object));
};

?>
===DONE===
--EXPECTF--
*** Testing get_resource_type() : variation test ***

-- bool --

Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d
NULL

-- int 10 --

Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d
NULL

-- float 10.5 --

Warning: get_resource_type() expects parameter 1 to be resource, float given in %s on line %d
NULL

-- string --

Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
NULL

-- array --

Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d
NULL

-- NULL --

Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d
NULL

-- Object --

Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d
NULL
===DONE===