summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt')
-rw-r--r--ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt b/ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt
new file mode 100644
index 0000000000..6efea38913
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_setValue_readonly.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test ReflectionProperty::setValue() error cases.
+--FILE--
+<?php
+
+enum Foo: int {
+ case Bar = 0;
+}
+
+$reflection = new ReflectionProperty(Foo::class, 'value');
+
+try {
+ $reflection->setValue(Foo::Bar, 1);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump(Foo::Bar->value);
+
+?>
+--EXPECT--
+Enum properties are immutable
+int(0)