diff options
Diffstat (limited to 'ext/reflection/tests/ReflectionEnum_construct.phpt')
-rw-r--r-- | ext/reflection/tests/ReflectionEnum_construct.phpt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/reflection/tests/ReflectionEnum_construct.phpt b/ext/reflection/tests/ReflectionEnum_construct.phpt new file mode 100644 index 0000000000..4b4a039105 --- /dev/null +++ b/ext/reflection/tests/ReflectionEnum_construct.phpt @@ -0,0 +1,34 @@ +--TEST-- +ReflectionEnum::__construct() +--FILE-- +<?php + +enum Foo {} +class Bar {} + +echo (new ReflectionEnum(Foo::class))->getName() . "\n"; + +try { + new ReflectionEnum('Bar'); +} catch (\Exception $e) { + echo $e->getMessage() . "\n"; +} + +try { + new ReflectionEnum('Baz'); +} catch (\Exception $e) { + echo $e->getMessage() . "\n"; +} + +try { + new ReflectionEnum([]); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} + +?> +--EXPECT-- +Foo +Class "Bar" is not an enum +Class "Baz" does not exist +ReflectionEnum::__construct(): Argument #1 ($objectOrClass) must be of type object|string, array given |