mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Add test case for final classes
This commit is contained in:
parent
c8bebdaf67
commit
4ff79c7d84
1 changed files with 25 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue