Annotation of embedaddon/php/ext/reflection/tests/025.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ReflectionFunction basic tests
3: --SKIPIF--
4: <?php extension_loaded('reflection') or die('skip'); ?>
5: --FILE--
6: <?php
7:
8: /**
9: hoho
10: */
11: function test ($a, $b = 1, $c = "") {
12: static $var = 1;
13: }
14:
15: $func = new ReflectionFunction("test");
16:
17: var_dump($func->export("test"));
18: echo "--getName--\n";
19: var_dump($func->getName());
20: echo "--isInternal--\n";
21: var_dump($func->isInternal());
22: echo "--isUserDefined--\n";
23: var_dump($func->isUserDefined());
24: echo "--getFilename--\n";
25: var_dump($func->getFilename());
26: echo "--getStartline--\n";
27: var_dump($func->getStartline());
28: echo "--getEndline--\n";
29: var_dump($func->getEndline());
30: echo "--getDocComment--\n";
31: var_dump($func->getDocComment());
32: echo "--getStaticVariables--\n";
33: var_dump($func->getStaticVariables());
34: echo "--invoke--\n";
35: var_dump($func->invoke(array(1,2,3)));
36: echo "--invokeArgs--\n";
37: var_dump($func->invokeArgs(array(1,2,3)));
38: echo "--returnsReference--\n";
39: var_dump($func->returnsReference());
40: echo "--getParameters--\n";
41: var_dump($func->getParameters());
42: echo "--getNumberOfParameters--\n";
43: var_dump($func->getNumberOfParameters());
44: echo "--getNumberOfRequiredParameters--\n";
45: var_dump($func->getNumberOfRequiredParameters());
46:
47: echo "Done\n";
48:
49: ?>
50: --EXPECTF--
51: /**
52: hoho
53: */
54: Function [ <user> function test ] {
55: @@ %s 6 - 8
56:
57: - Parameters [3] {
58: Parameter #0 [ <required> $a ]
59: Parameter #1 [ <optional> $b = 1 ]
60: Parameter #2 [ <optional> $c = '' ]
61: }
62: }
63:
64: NULL
65: --getName--
66: string(4) "test"
67: --isInternal--
68: bool(false)
69: --isUserDefined--
70: bool(true)
71: --getFilename--
72: string(%d) "%s025.php"
73: --getStartline--
74: int(6)
75: --getEndline--
76: int(8)
77: --getDocComment--
78: string(11) "/**
79: hoho
80: */"
81: --getStaticVariables--
82: array(1) {
83: ["var"]=>
84: int(1)
85: }
86: --invoke--
87: NULL
88: --invokeArgs--
89: NULL
90: --returnsReference--
91: bool(false)
92: --getParameters--
93: array(3) {
94: [0]=>
95: &object(ReflectionParameter)#2 (1) {
96: ["name"]=>
97: string(1) "a"
98: }
99: [1]=>
100: &object(ReflectionParameter)#3 (1) {
101: ["name"]=>
102: string(1) "b"
103: }
104: [2]=>
105: &object(ReflectionParameter)#4 (1) {
106: ["name"]=>
107: string(1) "c"
108: }
109: }
110: --getNumberOfParameters--
111: int(3)
112: --getNumberOfRequiredParameters--
113: int(1)
114: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>