Testing
tilttek/table-presenceThe 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\InMemoryPresenceStore, and the time is the MockClock of symfony/clock, moved forward by each test to the
millisecond it needs — the last one of a timeout or of a grace delay, and the one after. In the monorepo, Infection
holds the package at 100 % of covered mutants.
An application tests its own PresenceStore 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 policy, status, label, members, connections and moments read back to the millisecond.
Benchmarks
tests/Benchmark/PresenceBench.php builds the view of a full table — 40 members with 5 tabs each — as each member's
screen does at each change, sweeps that table as a scheduler does every few seconds, and runs an evening of 1 000
heartbeats with a sweep every ten. On PHP 8.5 without an opcode cache: the view in about 0.15 ms, the sweep in about
0.18 ms, the 1 000 heartbeats in about 9 ms, the store in memory.