Skip to content

Testing

tilttek/spotlight

The package's tests

composer install
vendor/bin/phpunit --no-configuration tests

The unit suite, under tests/Unit, runs without a kernel, a database or a network: the tables live in Store\InMemoryTableStore, and the time is the MockClock of symfony/clock, moved forward by each test to the moment it needs. In the monorepo, Infection holds the package at 100 % of covered mutants.

An application tests its own TableStore against the rules of the store: nothing for an identifier never kept, a new table kept once, a stale one refused, the version raised by one at each write, and the visibility, policy, queue, players and moments read back to the millisecond.

Benchmarks

tests/Benchmark/SpotlightBench.php builds the view of a full table — 20 players, 19 hands raised — as a screen does at each change, and passes 1 000 scenes on at a table of six. On PHP 8.5 without an opcode cache: the view in about 0.05 ms, the 1 000 scenes in about 18 ms, the store in memory.