Annotation of embedaddon/php/tests/classes/interface_doubled.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ZE2 An interface extends base interfaces
3: --SKIPIF--
4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5: --FILE--
6: <?php
7:
8: interface if_a {
9: function f_a();
10: }
11:
12: interface if_b {
13: function f_b();
14: }
15:
16: interface if_c extends if_a, if_b {
17: function f_c();
18: }
19:
20: interface if_d extends if_a, if_b {
21: function f_d();
22: }
23:
24: interface if_e {
25: function f_d();
26: }
27:
28: interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ {
29: }
30:
31: class base {
32: function test($class) {
33: echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n");
34: }
35: }
36:
37: echo "class_a\n";
38:
39: class class_a extends base implements if_a {
40: function f_a() {}
41: function f_b() {}
42: function f_c() {}
43: function f_d() {}
44: function f_e() {}
45: }
46:
47: $t = new class_a();
48: echo $t->test('if_a');
49: echo $t->test('if_b');
50: echo $t->test('if_c');
51: echo $t->test('if_d');
52: echo $t->test('if_e');
53:
54: echo "class_b\n";
55:
56: class class_b extends base implements if_a, if_b {
57: function f_a() {}
58: function f_b() {}
59: function f_c() {}
60: function f_d() {}
61: function f_e() {}
62: }
63:
64: $t = new class_b();
65: echo $t->test('if_a');
66: echo $t->test('if_b');
67: echo $t->test('if_c');
68: echo $t->test('if_d');
69: echo $t->test('if_e');
70:
71: echo "class_c\n";
72:
73: class class_c extends base implements if_c {
74: function f_a() {}
75: function f_b() {}
76: function f_c() {}
77: function f_d() {}
78: function f_e() {}
79: }
80:
81: $t = new class_c();
82: echo $t->test('if_a');
83: echo $t->test('if_b');
84: echo $t->test('if_c');
85: echo $t->test('if_d');
86: echo $t->test('if_e');
87:
88: echo "class_d\n";
89:
90: class class_d extends base implements if_d{
91: function f_a() {}
92: function f_b() {}
93: function f_c() {}
94: function f_d() {}
95: function f_e() {}
96: }
97:
98: $t = new class_d();
99: echo $t->test('if_a');
100: echo $t->test('if_b');
101: echo $t->test('if_c');
102: echo $t->test('if_d');
103: echo $t->test('if_e');
104:
105: echo "class_e\n";
106:
107: class class_e extends base implements if_a, if_b, if_c, if_d {
108: function f_a() {}
109: function f_b() {}
110: function f_c() {}
111: function f_d() {}
112: function f_e() {}
113: }
114:
115: $t = new class_e();
116: echo $t->test('if_a');
117: echo $t->test('if_b');
118: echo $t->test('if_c');
119: echo $t->test('if_d');
120: echo $t->test('if_e');
121:
122: echo "class_f\n";
123:
124: class class_f extends base implements if_e {
125: function f_a() {}
126: function f_b() {}
127: function f_c() {}
128: function f_d() {}
129: function f_e() {}
130: }
131:
132: $t = new class_f();
133: echo $t->test('if_a');
134: echo $t->test('if_b');
135: echo $t->test('if_c');
136: echo $t->test('if_d');
137: echo $t->test('if_e');
138:
139: echo "class_g\n";
140:
141: class class_g extends base implements if_f {
142: function f_a() {}
143: function f_b() {}
144: function f_c() {}
145: function f_d() {}
146: function f_e() {}
147: }
148:
149: $t = new class_g();
150: echo $t->test('if_a');
151: echo $t->test('if_b');
152: echo $t->test('if_c');
153: echo $t->test('if_d');
154: echo $t->test('if_e');
155:
156: ?>
157: ===DONE===
158: --EXPECTF--
159: class_a
160: is_a(class_a, if_a) yes
161: is_a(class_a, if_b) no
162: is_a(class_a, if_c) no
163: is_a(class_a, if_d) no
164: is_a(class_a, if_e) no
165: class_b
166: is_a(class_b, if_a) yes
167: is_a(class_b, if_b) yes
168: is_a(class_b, if_c) no
169: is_a(class_b, if_d) no
170: is_a(class_b, if_e) no
171: class_c
172: is_a(class_c, if_a) yes
173: is_a(class_c, if_b) yes
174: is_a(class_c, if_c) yes
175: is_a(class_c, if_d) no
176: is_a(class_c, if_e) no
177: class_d
178: is_a(class_d, if_a) yes
179: is_a(class_d, if_b) yes
180: is_a(class_d, if_c) no
181: is_a(class_d, if_d) yes
182: is_a(class_d, if_e) no
183: class_e
184: is_a(class_e, if_a) yes
185: is_a(class_e, if_b) yes
186: is_a(class_e, if_c) yes
187: is_a(class_e, if_d) yes
188: is_a(class_e, if_e) no
189: class_f
190: is_a(class_f, if_a) no
191: is_a(class_f, if_b) no
192: is_a(class_f, if_c) no
193: is_a(class_f, if_d) no
194: is_a(class_f, if_e) yes
195: class_g
196: is_a(class_g, if_a) yes
197: is_a(class_g, if_b) yes
198: is_a(class_g, if_c) yes
199: is_a(class_g, if_d) yes
200: is_a(class_g, if_e) no
201: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>