class StubsCacheIntegrityTest extends TestCase (View source)

Asserts the caches the validators read actually contain data.

Runner::isStubsCacheComplete() only checks that the six cache files exist — not that any of them holds anything. JsonParsedDataStorage::load() now throws on a file it cannot parse, so the specific failure that motivated this test (a truncated StubsClasses.json decoding to zero classes) can no longer pass silently. This test is the second line: it fails if a cache ever loads successfully but comes back empty or absurdly small.

That distinction matters because an empty cache does not make the suite red. Every check iterates the entities it is given; given none, it reports success. A green General run is therefore consistent with validating nothing at all, and only an explicit assertion on the size of the loaded data can tell the two apart.

The floors below are deliberately far under the real counts. They are a "did this load at all" tripwire, not an inventory — tightening them to the current numbers would turn every legitimate stub addition or removal into a failure.

Constants

private STUB_FLOORS

Entity type => minimum plausible count. Real counts as of PHP 8.6 support are given for context; the floors sit roughly an order of magnitude below them.

Methods

static array
stubEntityTypeProvider()

No description

void
testStubsCacheHoldsAPlausibleNumberOf(string $type, int $floor, int $observed)

No description

static array
phpVersionProvider()

No description

void
testReflectionCacheHoldsAPlausibleNumberOfEntities(string $phpVersion)

The reflection caches are the other half of every comparison. An empty one makes the checks for that version vacuous in exactly the same way.

Details

static array stubEntityTypeProvider()

No description

Return Value

array

void testStubsCacheHoldsAPlausibleNumberOf(string $type, int $floor, int $observed)

No description

Parameters

string $type
int $floor
int $observed

Return Value

void

static array phpVersionProvider()

No description

Return Value

array

void testReflectionCacheHoldsAPlausibleNumberOfEntities(string $phpVersion)

The reflection caches are the other half of every comparison. An empty one makes the checks for that version vacuous in exactly the same way.

The floors are much lower than the stub ones and that is expected, not a smell: the per-version Docker images load a fraction of the extensions the stubs describe. Measured across all 13 caches the minimum is PHP 5.6 with 156 classes and 1641 functions (the newest, 8.6, has 313 and 2183), so the floors sit just under the smallest real cache.

Parameters

string $phpVersion

Return Value

void