forked from php/php-src
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReflectionClass_hasMethod_basic.phpt
More file actions
57 lines (47 loc) · 1010 Bytes
/
ReflectionClass_hasMethod_basic.phpt
File metadata and controls
57 lines (47 loc) · 1010 Bytes
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
--TEST--
ReflectionClass::hasMethod()
--CREDITS--
Marc Veldman <marc@ibuildings.nl>
#testfest roosendaal on 2008-05-10
--FILE--
<?php
//New instance of class C - defined below
$rc = new ReflectionClass("C");
//Check if C has public method publicFoo
var_dump($rc->hasMethod('publicFoo'));
//Check if C has protected method protectedFoo
var_dump($rc->hasMethod('protectedFoo'));
//Check if C has private method privateFoo
var_dump($rc->hasMethod('privateFoo'));
//Check if C has static method staticFoo
var_dump($rc->hasMethod('staticFoo'));
//C should not have method bar
var_dump($rc->hasMethod('bar'));
//Method names are case insensitive
var_dump($rc->hasMethod('PUBLICfOO'));
Class C {
public function publicFoo()
{
return true;
}
protected function protectedFoo()
{
return true;
}
private function privateFoo()
{
return true;
}
static function staticFoo()
{
return true;
}
}
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)