Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ReflectionClass::getDefaultProperties(), ReflectionClass::getStaticProperties()
3: --CREDITS--
4: Robin Fernandes <robinf@php.net>
5: Steve Seear <stevseea@php.net>
6: --FILE--
7: <?php
8:
9:
10: class A {
11: static public $statPubC = "stat pubC in A";
12: static protected $statProtC = "stat protC in A";
13: static private $statPrivC = "stat privC in A";
14:
15: static public $statPubA = "stat pubA in A";
16: static protected $statProtA = "stat protA in A";
17: static private $statPrivA = "stat privA in A";
18:
19: public $pubC = "pubC in A";
20: protected $protC = "protC in A";
21: private $privC = "privC in A";
22:
23: public $pubA = "pubA in A";
24: protected $protA = "protA in A";
25: private $privA = "privA in A";
26: }
27:
28: class B extends A {
29: static public $statPubC = "stat pubC in B";
30: static protected $statProtC = "stat protC in B";
31: static private $statPrivC = "stat privC in B";
32:
33: static public $statPubB = "stat pubB in B";
34: static protected $statProtB = "stat protB in B";
35: static private $statPrivB = "stat privB in B";
36:
37: public $pubC = "pubC in B";
38: protected $protC = "protC in B";
39: private $privC = "privC in B";
40:
41: public $pubB = "pubB in B";
42: protected $protB = "protB in B";
43: private $privB = "privB in B";
44: }
45:
46: class C extends B {
47: static public $statPubC = "stat pubC in C";
48: static protected $statProtC = "stat protC in C";
49: static private $statPrivC = "stat privC in C";
50:
51: public $pubC = "pubC in C";
52: protected $protC = "protC in C";
53: private $privC = "privC in C";
54: }
55:
56: class X {
57: static public $statPubC = "stat pubC in X";
58: static protected $statProtC = "stat protC in X";
59: static private $statPrivC = "stat privC in X";
60:
61: public $pubC = "pubC in X";
62: protected $protC = "protC in X";
63: private $privC = "privC in X";
64: }
65:
66: $classes = array('A', 'B', 'C', 'X');
67: foreach ($classes as $class) {
68: $rc = new ReflectionClass($class);
69: echo "\n\n---- Static properties in $class ----\n";
70: print_r($rc->getStaticProperties());
71: echo "\n\n---- Default properties in $class ----\n";
72: print_r($rc->getDefaultProperties());
73: }
74:
75: ?>
76: --EXPECTF--
77: ---- Static properties in A ----
78: Array
79: (
80: [statPubC] => stat pubC in A
81: [statProtC] => stat protC in A
82: [statPrivC] => stat privC in A
83: [statPubA] => stat pubA in A
84: [statProtA] => stat protA in A
85: [statPrivA] => stat privA in A
86: )
87:
88:
89: ---- Default properties in A ----
90: Array
91: (
92: [statPubC] => stat pubC in A
93: [statProtC] => stat protC in A
94: [statPrivC] => stat privC in A
95: [statPubA] => stat pubA in A
96: [statProtA] => stat protA in A
97: [statPrivA] => stat privA in A
98: [pubC] => pubC in A
99: [protC] => protC in A
100: [privC] => privC in A
101: [pubA] => pubA in A
102: [protA] => protA in A
103: [privA] => privA in A
104: )
105:
106:
107: ---- Static properties in B ----
108: Array
109: (
110: [statPubC] => stat pubC in B
111: [statProtC] => stat protC in B
112: [statPrivC] => stat privC in B
113: [statPubB] => stat pubB in B
114: [statProtB] => stat protB in B
115: [statPrivB] => stat privB in B
116: [statPubA] => stat pubA in A
117: [statProtA] => stat protA in A
118: )
119:
120:
121: ---- Default properties in B ----
122: Array
123: (
124: [statPubC] => stat pubC in B
125: [statProtC] => stat protC in B
126: [statPrivC] => stat privC in B
127: [statPubB] => stat pubB in B
128: [statProtB] => stat protB in B
129: [statPrivB] => stat privB in B
130: [statPubA] => stat pubA in A
131: [statProtA] => stat protA in A
132: [pubC] => pubC in B
133: [protC] => protC in B
134: [privC] => privC in B
135: [pubB] => pubB in B
136: [protB] => protB in B
137: [privB] => privB in B
138: [pubA] => pubA in A
139: [protA] => protA in A
140: )
141:
142:
143: ---- Static properties in C ----
144: Array
145: (
146: [statPubC] => stat pubC in C
147: [statProtC] => stat protC in C
148: [statPrivC] => stat privC in C
149: [statPubB] => stat pubB in B
150: [statProtB] => stat protB in B
151: [statPubA] => stat pubA in A
152: [statProtA] => stat protA in A
153: )
154:
155:
156: ---- Default properties in C ----
157: Array
158: (
159: [statPubC] => stat pubC in C
160: [statProtC] => stat protC in C
161: [statPrivC] => stat privC in C
162: [statPubB] => stat pubB in B
163: [statProtB] => stat protB in B
164: [statPubA] => stat pubA in A
165: [statProtA] => stat protA in A
166: [pubC] => pubC in C
167: [protC] => protC in C
168: [privC] => privC in C
169: [pubB] => pubB in B
170: [protB] => protB in B
171: [pubA] => pubA in A
172: [protA] => protA in A
173: )
174:
175:
176: ---- Static properties in X ----
177: Array
178: (
179: [statPubC] => stat pubC in X
180: [statProtC] => stat protC in X
181: [statPrivC] => stat privC in X
182: )
183:
184:
185: ---- Default properties in X ----
186: Array
187: (
188: [statPubC] => stat pubC in X
189: [statProtC] => stat protC in X
190: [statPrivC] => stat privC in X
191: [pubC] => pubC in X
192: [protC] => protC in X
193: [privC] => privC in X
194: )
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>