1--TEST--
2ReflectionClass::getInterfaces()
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8class A0 {}
9class B0 extends A0 {}
10abstract class A1 {}
11class B1 extends A1 {}
12
13interface I0 {}
14interface I1 {}
15interface I2 {}
16interface I3 {}
17interface I4 extends I3 {}
18interface I5 extends I4 {}
19interface I6 extends I5, I1, I2 {}
20interface I7 extends I6 {}
21
22class C0 implements I0 {}
23class C1 implements I1, I3 {}
24class C2 extends C1 {}
25class C3 extends C2 implements I1 {}
26class C4 extends C3 implements I2 {}
27class C5 extends C4 implements I7 {}
28class C6 implements I1, I2, I3, I4, I5, I6, I7 {}
29
30
31$classes = array( 	'A0', 'A1', 'B0', 'B1',
32					'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7',
33					'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6'	);
34
35foreach ($classes as $class) {
36	echo "---( Interfaces implemented by $class )---\n ";
37	$rc = new ReflectionClass($class);
38	$interfaces = $rc->getInterfaces();
39	// Sort interfaces so that tests do not fail because of wrong order.
40	ksort($interfaces);
41	print_r($interfaces);
42}
43
44?>
45--EXPECT--
46---( Interfaces implemented by A0 )---
47 Array
48(
49)
50---( Interfaces implemented by A1 )---
51 Array
52(
53)
54---( Interfaces implemented by B0 )---
55 Array
56(
57)
58---( Interfaces implemented by B1 )---
59 Array
60(
61)
62---( Interfaces implemented by I0 )---
63 Array
64(
65)
66---( Interfaces implemented by I1 )---
67 Array
68(
69)
70---( Interfaces implemented by I2 )---
71 Array
72(
73)
74---( Interfaces implemented by I3 )---
75 Array
76(
77)
78---( Interfaces implemented by I4 )---
79 Array
80(
81    [I3] => ReflectionClass Object
82        (
83            [name] => I3
84        )
85
86)
87---( Interfaces implemented by I5 )---
88 Array
89(
90    [I3] => ReflectionClass Object
91        (
92            [name] => I3
93        )
94
95    [I4] => ReflectionClass Object
96        (
97            [name] => I4
98        )
99
100)
101---( Interfaces implemented by I6 )---
102 Array
103(
104    [I1] => ReflectionClass Object
105        (
106            [name] => I1
107        )
108
109    [I2] => ReflectionClass Object
110        (
111            [name] => I2
112        )
113
114    [I3] => ReflectionClass Object
115        (
116            [name] => I3
117        )
118
119    [I4] => ReflectionClass Object
120        (
121            [name] => I4
122        )
123
124    [I5] => ReflectionClass Object
125        (
126            [name] => I5
127        )
128
129)
130---( Interfaces implemented by I7 )---
131 Array
132(
133    [I1] => ReflectionClass Object
134        (
135            [name] => I1
136        )
137
138    [I2] => ReflectionClass Object
139        (
140            [name] => I2
141        )
142
143    [I3] => ReflectionClass Object
144        (
145            [name] => I3
146        )
147
148    [I4] => ReflectionClass Object
149        (
150            [name] => I4
151        )
152
153    [I5] => ReflectionClass Object
154        (
155            [name] => I5
156        )
157
158    [I6] => ReflectionClass Object
159        (
160            [name] => I6
161        )
162
163)
164---( Interfaces implemented by C0 )---
165 Array
166(
167    [I0] => ReflectionClass Object
168        (
169            [name] => I0
170        )
171
172)
173---( Interfaces implemented by C1 )---
174 Array
175(
176    [I1] => ReflectionClass Object
177        (
178            [name] => I1
179        )
180
181    [I3] => ReflectionClass Object
182        (
183            [name] => I3
184        )
185
186)
187---( Interfaces implemented by C2 )---
188 Array
189(
190    [I1] => ReflectionClass Object
191        (
192            [name] => I1
193        )
194
195    [I3] => ReflectionClass Object
196        (
197            [name] => I3
198        )
199
200)
201---( Interfaces implemented by C3 )---
202 Array
203(
204    [I1] => ReflectionClass Object
205        (
206            [name] => I1
207        )
208
209    [I3] => ReflectionClass Object
210        (
211            [name] => I3
212        )
213
214)
215---( Interfaces implemented by C4 )---
216 Array
217(
218    [I1] => ReflectionClass Object
219        (
220            [name] => I1
221        )
222
223    [I2] => ReflectionClass Object
224        (
225            [name] => I2
226        )
227
228    [I3] => ReflectionClass Object
229        (
230            [name] => I3
231        )
232
233)
234---( Interfaces implemented by C5 )---
235 Array
236(
237    [I1] => ReflectionClass Object
238        (
239            [name] => I1
240        )
241
242    [I2] => ReflectionClass Object
243        (
244            [name] => I2
245        )
246
247    [I3] => ReflectionClass Object
248        (
249            [name] => I3
250        )
251
252    [I4] => ReflectionClass Object
253        (
254            [name] => I4
255        )
256
257    [I5] => ReflectionClass Object
258        (
259            [name] => I5
260        )
261
262    [I6] => ReflectionClass Object
263        (
264            [name] => I6
265        )
266
267    [I7] => ReflectionClass Object
268        (
269            [name] => I7
270        )
271
272)
273---( Interfaces implemented by C6 )---
274 Array
275(
276    [I1] => ReflectionClass Object
277        (
278            [name] => I1
279        )
280
281    [I2] => ReflectionClass Object
282        (
283            [name] => I2
284        )
285
286    [I3] => ReflectionClass Object
287        (
288            [name] => I3
289        )
290
291    [I4] => ReflectionClass Object
292        (
293            [name] => I4
294        )
295
296    [I5] => ReflectionClass Object
297        (
298            [name] => I5
299        )
300
301    [I6] => ReflectionClass Object
302        (
303            [name] => I6
304        )
305
306    [I7] => ReflectionClass Object
307        (
308            [name] => I7
309        )
310
311)
312