CheckVersionGatingConsistencyTest
class CheckVersionGatingConsistencyTest extends TestCase (View source)
Guards the two places PHP-version applicability is expressed against each other.
Version gating is stated twice: declaratively by each CheckDescriptor's
from/to range, and imperatively by the check's own supports(). Nothing in the
type system ties them together, so a registration can ask for a version its
check refuses. Before ValidatorTestBase was changed to fail on that, the
mismatch surfaced as a skipped test — invisible in a green run.
These tests catch the disagreement in the unit suite, in milliseconds, instead of leaving it to a 20-plus-minute integration run. They deliberately do not assert the two are identical: a descriptor narrower than its check's gate is legitimate (a check may be meaningful from 8.0 while only being scheduled for the latest version). Only the reverse — a descriptor reaching beyond what the check supports — is a defect.
Scope limit: only declarative CheckDescriptor registrations are covered. The attribute-based mode (#[PhpVersionRange] on a check* method) instantiates its check inline in the method body, so its registrations cannot be enumerated without parsing those bodies. That mode is currently limited to three call sites in PhpDocValidatorTest, all on checks whose supports() is unconditionally true, so it cannot drift today — and if it ever does, ValidatorTestBase::executeCheck() fails rather than skipping, so the mismatch is still loud. It is just not caught as early as it is here.
Methods
No description
No description
Every version a descriptor schedules must be one its check actually supports.
A descriptor whose range contains no known PHP version can never emit a test case, so the check it registers would silently never run.
Details
static iterable
descriptorProvider()
No description
void
testAtLeastOneDescriptorWasDiscovered()
No description
void
testDescriptorRangeIsFullySupportedByItsCheck(string $testClass, string $key, CheckDescriptor $descriptor)
Every version a descriptor schedules must be one its check actually supports.
void
testDescriptorRangeContainsAtLeastOneKnownVersion(string $testClass, string $key, CheckDescriptor $descriptor)
A descriptor whose range contains no known PHP version can never emit a test case, so the check it registers would silently never run.