php-src/Zend/tests/010.phpt
Máté Kocsis c98d47696f
Consolidate new union type ZPP macro names
They will now follow the canonical order of types. Older macros are
left intact due to maintaining BC.

Closes GH-6112
2020-09-11 11:00:18 +02:00

85 lines
1.8 KiB
PHP

--TEST--
get_parent_class() tests
--FILE--
<?php
interface i {
function test();
}
class foo implements i {
function test() {
var_dump(get_parent_class());
}
}
class bar extends foo {
function test_bar() {
var_dump(get_parent_class());
}
}
$bar = new bar;
$foo = new foo;
$foo->test();
$bar->test();
$bar->test_bar();
var_dump(get_parent_class($bar));
var_dump(get_parent_class($foo));
var_dump(get_parent_class("bar"));
var_dump(get_parent_class("foo"));
var_dump(get_parent_class("i"));
try {
get_parent_class("");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class("[[[[");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class(" ");
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
var_dump(get_parent_class(new stdclass));
try {
get_parent_class(array());
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
get_parent_class(1);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
echo "Done\n";
?>
--EXPECT--
bool(false)
bool(false)
string(3) "foo"
string(3) "foo"
bool(false)
string(3) "foo"
bool(false)
bool(false)
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
bool(false)
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given
get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given
Done