php-testing
Installation
SKILL.md
PHP Testing
Test Architecture: The Test Pyramid
- Unit tests (70-80%) — Fast (< 1ms each), no I/O, test one behavioral unit. Run on every file save.
- Integration tests (15-20%) — Cross one system boundary (database, HTTP, filesystem). Run on every commit.
- E2E tests (5-10%) — Full system through UI or public API. Run pre-deploy or nightly.
Principle: prefer the cheapest test that adequately covers the risk.
Unit test candidates: Pure functions, value objects, domain logic, service classes with mocked collaborators, complex conditionals.
Do NOT unit test: Getters/setters with no logic, framework infrastructure, configuration, database schema.
Integration test candidates: Repository implementations, HTTP handlers, service coordination, event publishing.