xref: /PHP-7.2/Zend/tests/010.phpt (revision 17ccbeec)
1--TEST--
2get_parent_class() tests
3--FILE--
4<?php
5
6interface i {
7	function test();
8}
9
10class foo implements i {
11	function test() {
12		var_dump(get_parent_class());
13	}
14}
15
16class bar extends foo {
17	function test_bar() {
18		var_dump(get_parent_class());
19	}
20}
21
22$bar = new bar;
23$foo = new foo;
24
25$foo->test();
26$bar->test();
27$bar->test_bar();
28
29var_dump(get_parent_class($bar));
30var_dump(get_parent_class($foo));
31var_dump(get_parent_class("bar"));
32var_dump(get_parent_class("foo"));
33var_dump(get_parent_class("i"));
34
35var_dump(get_parent_class(""));
36var_dump(get_parent_class("[[[["));
37var_dump(get_parent_class(" "));
38var_dump(get_parent_class(new stdclass));
39var_dump(get_parent_class(array()));
40var_dump(get_parent_class(1));
41
42echo "Done\n";
43?>
44--EXPECTF--
45bool(false)
46bool(false)
47string(3) "foo"
48string(3) "foo"
49bool(false)
50string(3) "foo"
51bool(false)
52bool(false)
53bool(false)
54bool(false)
55bool(false)
56bool(false)
57bool(false)
58bool(false)
59Done
60