Annotation of embedaddon/php/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ReflectionMethod::getStaticVariables()
3: --FILE--
4: <?php
5:
6: class TestClass {
7: public function foo() {
8: static $c;
9: static $a = 1;
10: static $b = "hello";
11: $d = 5;
12: }
13:
14: private function bar() {
15: static $a = 1;
16: }
17:
18: public function noStatics() {
19: $a = 54;
20: }
21: }
22:
23: echo "Public method:\n";
24: $methodInfo = new ReflectionMethod('TestClass::foo');
25: var_dump($methodInfo->getStaticVariables());
26:
27: echo "\nPrivate method:\n";
28: $methodInfo = new ReflectionMethod('TestClass::bar');
29: var_dump($methodInfo->getStaticVariables());
30:
31: echo "\nMethod with no static variables:\n";
32: $methodInfo = new ReflectionMethod('TestClass::noStatics');
33: var_dump($methodInfo->getStaticVariables());
34:
35: echo "\nInternal Method:\n";
36: $methodInfo = new ReflectionMethod('ReflectionClass::getName');
37: var_dump($methodInfo->getStaticVariables());
38:
39: ?>
40: --EXPECT--
41: Public method:
42: array(3) {
43: ["c"]=>
44: NULL
45: ["a"]=>
46: int(1)
47: ["b"]=>
48: string(5) "hello"
49: }
50:
51: Private method:
52: array(1) {
53: ["a"]=>
54: int(1)
55: }
56:
57: Method with no static variables:
58: array(0) {
59: }
60:
61: Internal Method:
62: array(0) {
63: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>