Skip to content

Commit ce1bab4

Browse files
Better tests
1 parent 9a04e97 commit ce1bab4

File tree

2 files changed

+17
-115
lines changed

2 files changed

+17
-115
lines changed

ext/reflection/tests/ReflectionClass_getProperties_003.phpt

Lines changed: 12 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ class C {
1414
static public $pubs2;
1515
static private $privs1;
1616
static private $privs2;
17-
public $pubVirt1 { get {} set {} }
18-
public $pubVirt2 { get {} }
19-
public $pubVirt3 { set {} }
20-
private $privVirt1 { get {} set {} }
21-
private $privVirt2 { get {} }
22-
private $privVirt3 { set {} }
17+
public $hookNoVirt { set { $this->hookNoVirt = strtoupper( $value ); } }
18+
public $hookVirt { get { return 42; } }
2319
}
2420

2521
$rc = new ReflectionClass("C");
@@ -49,7 +45,7 @@ var_dump($rc->getProperties($virtFlag));
4945
--EXPECTF--
5046
No properties:array(0) {
5147
}
52-
Public properties:array(7) {
48+
Public properties:array(6) {
5349
[0]=>
5450
object(ReflectionProperty)#%d (2) {
5551
["name"]=>
@@ -81,26 +77,19 @@ Public properties:array(7) {
8177
[4]=>
8278
object(ReflectionProperty)#%d (2) {
8379
["name"]=>
84-
string(8) "pubVirt1"
80+
string(10) "hookNoVirt"
8581
["class"]=>
8682
string(1) "C"
8783
}
8884
[5]=>
8985
object(ReflectionProperty)#%d (2) {
9086
["name"]=>
91-
string(8) "pubVirt2"
92-
["class"]=>
93-
string(1) "C"
94-
}
95-
[6]=>
96-
object(ReflectionProperty)#%d (2) {
97-
["name"]=>
98-
string(8) "pubVirt3"
87+
string(8) "hookVirt"
9988
["class"]=>
10089
string(1) "C"
10190
}
10291
}
103-
Private properties:array(7) {
92+
Private properties:array(4) {
10493
[0]=>
10594
object(ReflectionProperty)#%d (2) {
10695
["name"]=>
@@ -129,29 +118,8 @@ Private properties:array(7) {
129118
["class"]=>
130119
string(1) "C"
131120
}
132-
[4]=>
133-
object(ReflectionProperty)#%d (2) {
134-
["name"]=>
135-
string(9) "privVirt1"
136-
["class"]=>
137-
string(1) "C"
138-
}
139-
[5]=>
140-
object(ReflectionProperty)#%d (2) {
141-
["name"]=>
142-
string(9) "privVirt2"
143-
["class"]=>
144-
string(1) "C"
145-
}
146-
[6]=>
147-
object(ReflectionProperty)#%d (2) {
148-
["name"]=>
149-
string(9) "privVirt3"
150-
["class"]=>
151-
string(1) "C"
152-
}
153121
}
154-
Public or static properties:array(9) {
122+
Public or static properties:array(8) {
155123
[0]=>
156124
object(ReflectionProperty)#%d (2) {
157125
["name"]=>
@@ -197,26 +165,19 @@ Public or static properties:array(9) {
197165
[6]=>
198166
object(ReflectionProperty)#%d (2) {
199167
["name"]=>
200-
string(8) "pubVirt1"
168+
string(10) "hookNoVirt"
201169
["class"]=>
202170
string(1) "C"
203171
}
204172
[7]=>
205173
object(ReflectionProperty)#%d (2) {
206174
["name"]=>
207-
string(8) "pubVirt2"
208-
["class"]=>
209-
string(1) "C"
210-
}
211-
[8]=>
212-
object(ReflectionProperty)#%d (2) {
213-
["name"]=>
214-
string(8) "pubVirt3"
175+
string(8) "hookVirt"
215176
["class"]=>
216177
string(1) "C"
217178
}
218179
}
219-
Private or static properties:array(9) {
180+
Private or static properties:array(6) {
220181
[0]=>
221182
object(ReflectionProperty)#%d (2) {
222183
["name"]=>
@@ -259,68 +220,12 @@ Private or static properties:array(9) {
259220
["class"]=>
260221
string(1) "C"
261222
}
262-
[6]=>
263-
object(ReflectionProperty)#%d (2) {
264-
["name"]=>
265-
string(9) "privVirt1"
266-
["class"]=>
267-
string(1) "C"
268-
}
269-
[7]=>
270-
object(ReflectionProperty)#%d (2) {
271-
["name"]=>
272-
string(9) "privVirt2"
273-
["class"]=>
274-
string(1) "C"
275-
}
276-
[8]=>
277-
object(ReflectionProperty)#%d (2) {
278-
["name"]=>
279-
string(9) "privVirt3"
280-
["class"]=>
281-
string(1) "C"
282-
}
283223
}
284-
Virtual properties:array(6) {
224+
Virtual properties:array(1) {
285225
[0]=>
286226
object(ReflectionProperty)#%d (2) {
287227
["name"]=>
288-
string(8) "pubVirt1"
289-
["class"]=>
290-
string(1) "C"
291-
}
292-
[1]=>
293-
object(ReflectionProperty)#%d (2) {
294-
["name"]=>
295-
string(8) "pubVirt2"
296-
["class"]=>
297-
string(1) "C"
298-
}
299-
[2]=>
300-
object(ReflectionProperty)#%d (2) {
301-
["name"]=>
302-
string(8) "pubVirt3"
303-
["class"]=>
304-
string(1) "C"
305-
}
306-
[3]=>
307-
object(ReflectionProperty)#%d (2) {
308-
["name"]=>
309-
string(9) "privVirt1"
310-
["class"]=>
311-
string(1) "C"
312-
}
313-
[4]=>
314-
object(ReflectionProperty)#%d (2) {
315-
["name"]=>
316-
string(9) "privVirt2"
317-
["class"]=>
318-
string(1) "C"
319-
}
320-
[5]=>
321-
object(ReflectionProperty)#%d (2) {
322-
["name"]=>
323-
string(9) "privVirt3"
228+
string(8) "hookVirt"
324229
["class"]=>
325230
string(1) "C"
326231
}

ext/reflection/tests/ReflectionProperty_getModifiers_basic.phpt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ class C {
1212
static private $a6;
1313
public final $a7;
1414
public static final $a8;
15-
public $a9 { get {} set {} }
16-
public $a10 { get {} }
17-
public $a11 { set {} }
15+
public $a9 { set { $this->a9 = strtoupper( $value ); } }
16+
public $a10 { get { return 42; } }
1817
}
1918

2019
class D extends C {
@@ -26,7 +25,7 @@ class D extends C {
2625
static private $a6;
2726
}
2827

29-
for ($i = 1;$i <= 11;$i++) {
28+
for ($i = 1;$i <= 10;$i++) {
3029
$rp = new ReflectionProperty("C", "a$i");
3130
echo "C::a$i: ";
3231
var_dump($rp->getModifiers());
@@ -53,9 +52,7 @@ C::a7: int(33)
5352
D::a7: int(33)
5453
C::a8: int(49)
5554
D::a8: int(49)
56-
C::a9: int(513)
57-
D::a9: int(513)
55+
C::a9: int(1)
56+
D::a9: int(1)
5857
C::a10: int(513)
5958
D::a10: int(513)
60-
C::a11: int(513)
61-
D::a11: int(513)

0 commit comments

Comments
 (0)