summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-unset-propertes.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/enum/no-unset-propertes.phpt')
-rw-r--r--Zend/tests/enum/no-unset-propertes.phpt37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zend/tests/enum/no-unset-propertes.phpt b/Zend/tests/enum/no-unset-propertes.phpt
new file mode 100644
index 0000000000..338b22a026
--- /dev/null
+++ b/Zend/tests/enum/no-unset-propertes.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Enum properties cannot be unset
+--FILE--
+<?php
+
+enum Foo {
+ case Bar;
+}
+
+enum IntFoo: int {
+ case Bar = 0;
+}
+
+$foo = Foo::Bar;
+try {
+ unset($foo->name);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+$intFoo = IntFoo::Bar;
+try {
+ unset($intFoo->name);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ unset($intFoo->value);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Enum properties are immutable
+Enum properties are immutable
+Enum properties are immutable