AGENTS
August 7, 2026 · View on GitHub
Read root AGENTS.md first.
Purpose
PHPUnit tests that lock skeleton behavior.
After application-code changes (see root AGENTS.md Testing & static analysis):
composer test
composer analyse # PHPStan level 8
# or: composer check
Flight nuances (easy to get wrong)
- Prefer unit tests that construct controllers/middleware with a mocked or real
Engine, not a full HTTP boot throughpublic/index.php. render,json,response,requeston Engine are often mapped / magic (__call), not always real PHP methods. With PHPUnit mocks useaddMethods(['render'])(or similar) for magic methods; useonlyMethodsfor real methods likeget/set.- Do not use
Flight::statics in tests if you can inject Engine — matches production app code. - No real external services (SMTP, paid APIs). Mock them.
- SQLite temp files are fine for migration/DB helper tests; clean up in
tearDown. - Config tests should cover
mergeEnv(env wins, empty ignored) — this is security-adjacent for deploy overlays. - Do not assert on Tracy HTML or full layout chrome unless necessary; assert behavior and key output.
Layout
tests/Unit/— default for fast tests- Mirror class names:
HomeControllerTestforHomeController
Do not
- Require a running web server for unit tests.
- Depend on developer’s personal
.envsecrets; construct Config arrays in the test.