Skip to content

Invariant-focused testing examples

High-value tests target the invariant and the real boundary:

  • A feature test proves tenant A cannot resolve or authorize tenant B’s project.
  • A database integration test proves a unique constraint rejects duplicate idempotency keys.
  • A concurrency test proves stock cannot become negative.
  • A job test proves redelivery after partial completion does not repeat the external effect.

Do not replace these with a controller mock asserting that reserve() was called once; that proves wiring, not correctness.

The focused Laravel confidence-boundary example separates an HTTP dispatch assertion from real handler execution and deliberately records what still requires a queue-worker smoke test.