xref: /PHP-7.0/ext/spl/tests/spl_003.phpt (revision 610c7fbe)
1--TEST--
2SPL: class_parents() and class_implements()
3--FILE--
4<?php
5class a{}
6class b extends a{}
7class c extends b{}
8class d{}
9var_dump(class_parents(new c),
10         class_parents("c"),
11         class_parents(new b),
12         class_parents("b"),
13         class_parents("d"),
14         class_parents("foo", 0),
15         class_parents("foo", 1)
16);
17
18interface iface1{}
19interface iface2{}
20class f implements iface1, iface2{}
21var_dump(class_implements(new a),
22         class_implements("a"),
23         class_implements("aaa"),
24         class_implements("bbb", 0)
25);
26
27function __autoload($cname) {
28    var_dump($cname);
29}
30
31?>
32===DONE===
33<?php exit(0); ?>
34--EXPECTF--
35Warning: class_parents(): Class foo does not exist in %sspl_003.php on line %d
36string(3) "foo"
37
38Warning: class_parents(): Class foo does not exist and could not be loaded in %sspl_003.php on line %d
39array(2) {
40  ["b"]=>
41  string(1) "b"
42  ["a"]=>
43  string(1) "a"
44}
45array(2) {
46  ["b"]=>
47  string(1) "b"
48  ["a"]=>
49  string(1) "a"
50}
51array(1) {
52  ["a"]=>
53  string(1) "a"
54}
55array(1) {
56  ["a"]=>
57  string(1) "a"
58}
59array(0) {
60}
61bool(false)
62bool(false)
63string(3) "aaa"
64
65Warning: class_implements(): Class aaa does not exist and could not be loaded in %sspl_003.php on line %d
66
67Warning: class_implements(): Class bbb does not exist in %sspl_003.php on line %d
68array(0) {
69}
70array(0) {
71}
72bool(false)
73bool(false)
74===DONE===
75