diff --git a/tests/Utilities/ReflectionTest.php b/tests/Utilities/ReflectionTest.php index edf5344..44186d5 100644 --- a/tests/Utilities/ReflectionTest.php +++ b/tests/Utilities/ReflectionTest.php @@ -458,6 +458,17 @@ class ReflectionTest extends BaseTestCase static::assertNull(Reflection::getConstantValue(H::class, 'users')); } + /** + * @param object|string $class The object or name of object's class + * @param array $expected Expected constants + * + * @dataProvider provideClassToGetConstants + */ + public function testGetConstants($class, array $expected): void + { + static::assertSame($expected, Reflection::getConstants($class)); + } + public function testGetConstantValue() { static::assertSame(H::LOREM, Reflection::getConstantValue(H::class, 'LOREM')); @@ -749,4 +760,27 @@ class ReflectionTest extends BaseTestCase ], ]; } + + public function provideClassToGetConstants(): ?Generator + { + yield[ + new \stdClass(), + [], + ]; + + yield[ + \stdClass::class, + [], + ]; + + yield[ + H::class, + [ + 'DOLOR' => 'sit', + 'LOREM' => 'ipsum', + 'MAX_USERS' => 5, + 'MIN_USERS' => 2, + ], + ]; + } }