mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Missing test of Reflection::getConstants() method
This commit is contained in:
@@ -458,6 +458,17 @@ class ReflectionTest extends BaseTestCase
|
|||||||
static::assertNull(Reflection::getConstantValue(H::class, 'users'));
|
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()
|
public function testGetConstantValue()
|
||||||
{
|
{
|
||||||
static::assertSame(H::LOREM, Reflection::getConstantValue(H::class, 'LOREM'));
|
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,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user