EnumValidatorTest
class EnumValidatorTest extends ValidatorTestBase (View source)
Validates that enums from reflection exist in stubs and their methods are correct.
Enums were introduced in PHP 8.1, so most checks use PHP_8_1 as the lower bound.
Each enum is tested individually as a separate test case, making it easy to identify failures and re-run specific tests.
Methods
Return check descriptors for declarative test registration.
Generic data provider that yields [checkName, entityId, phpVersion] for each entity.
No description
Get entities to test based on the method name.
Get the unique identifier for an entity.
Build a unique test name from method, entity, and version.
Execute a validation check and assert results.
Details
protected void
setUp()
No description
static protected array
getCheckDescriptors()
Return check descriptors for declarative test registration.
Each entry maps a logical check name to a CheckDescriptor.
static iterable
entityProvider()
Generic data provider that yields [checkName, entityId, phpVersion] for each entity.
When getCheckDescriptors() returns entries, iterates those descriptors. Otherwise falls back to scanning methods for PhpVersionRange attributes.
void
testEntity(string $methodName, string $entityId, string $phpVersion)
No description
static protected iterable
getEntitiesForMethod(string $methodName, StubDataQueryInterface $reflection)
Get entities to test based on the method name.
Subclasses should override to return specific entity types.
static protected string
getEntityId(mixed $entity)
Get the unique identifier for an entity.
static protected string
buildTestName(string $methodName, string $entityId, string $phpVersion)
Build a unique test name from method, entity, and version.
protected void
executeCheck(CheckInterface $check, string $entityId, string $phpVersion, string|null $customMessage = null)
Execute a validation check and assert results.