mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Add test case for final classes
This commit is contained in:
parent
c8bebdaf67
commit
4ff79c7d84
25
tests/classes/class_final.phpt
Executable file
25
tests/classes/class_final.phpt
Executable file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
A final class cannot be inherited
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
final class base {
|
||||
function show() {
|
||||
echo "base\n";
|
||||
}
|
||||
}
|
||||
|
||||
$t = new base();
|
||||
$t->show();
|
||||
|
||||
class derived extends base {
|
||||
}
|
||||
|
||||
echo "Done\n"; // shouldn't be displayed
|
||||
?>
|
||||
--EXPECTF--
|
||||
base
|
||||
|
||||
Fatal error: Class derived may not inherit from final class (base) in %s on line %d
|
Loading…
Reference in New Issue
Block a user