class ClassValidatorTest extends ValidatorTestBase (View source)

Validates that classes from reflection exist in stubs.

Each class is tested individually as a separate test case, making it easy to identify failures and re-run specific tests.

Methods

void
setUp()

No description

static array
getCheckDescriptors()

Return check descriptors for declarative test registration.

static iterable
entityProvider()

Generic data provider that yields [checkName, entityId, phpVersion] for each entity.

void
testEntity(string $methodName, string $entityId, string $phpVersion)

No description

static iterable
getEntitiesForMethod(string $methodName, StubDataQueryInterface $reflection)

Get entities to test based on the method name.

static string
getEntityId(mixed $entity)

Get the unique identifier for an entity.

static string
buildTestName(string $methodName, string $entityId, string $phpVersion)

Build a unique test name from method, entity, and version.

void
executeCheck(CheckInterface $check, string $entityId, string $phpVersion, string|null $customMessage = null)

Execute a validation check and assert results.

Details

protected void setUp()

No description

Return Value

void

static protected array getCheckDescriptors()

Return check descriptors for declarative test registration.

Each entry maps a logical check name to a CheckDescriptor.

Return Value

array

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.

Return Value

iterable

void testEntity(string $methodName, string $entityId, string $phpVersion)

No description

Parameters

string $methodName
string $entityId
string $phpVersion

Return Value

void

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.

Parameters

string $methodName
StubDataQueryInterface $reflection

Return Value

iterable

static protected string getEntityId(mixed $entity)

Get the unique identifier for an entity.

Parameters

mixed $entity

Return Value

string

static protected string buildTestName(string $methodName, string $entityId, string $phpVersion)

Build a unique test name from method, entity, and version.

Parameters

string $methodName
string $entityId
string $phpVersion

Return Value

string

protected void executeCheck(CheckInterface $check, string $entityId, string $phpVersion, string|null $customMessage = null)

Execute a validation check and assert results.

Parameters

CheckInterface $check

The validation check to run

string $entityId

The entity identifier

string $phpVersion

The PHP version

string|null $customMessage

Optional custom assertion message

Return Value

void