Testing
The test suite is deliberately strict: 100% type coverage, byte-exact golden-vector signing tests, and a healthy mix of unit and feature tests. This page explains the stack and how to run everything.
The Test Stack
| Tool | Version | Purpose |
|---|---|---|
| Pest | 5 | Test framework |
| pest-plugin-type-coverage | 5 | Type coverage enforcement |
| PHPStan + Larastan | 3.x / 3.9+ | Static analysis |
| Pint | 1.29+ | Code style |
| Orchestra Testbench | 11 | Laravel package testing |
Running Tests
# Full validation (analyse + lint:check + test:types + test:unit)
composer test
# Static analysis only
composer analyse
# Code style check only
composer lint:check
# Type coverage only (100% enforced)
composer test:types
# Unit tests only
composer test:unitType Coverage
Type coverage is enforced at 100% via the test:types script:
composer test:types --min=100Every parameter, return type, and property type must be explicitly declared. New code that lowers coverage will fail CI.
Golden-Vector Signing Tests
The test suite includes golden-vector tests for URL signing (src/UrlSigner.php). These verify that the HMAC-SHA256 signature, URL-safe base64 encoding, and signature_size truncation produce byte-exact results against known inputs. They run without any external dependencies.
Live Integration Tests
The test suite includes live checks against a real imgproxy running locally in Docker. They are gated behind three environment variables and skip when they are not set (CI never sets them):
IMGPROXY_URL=http://localhost:8081
IMGPROXY_KEY=0000000000000000000000000000000000000000000000000000000000000000
IMGPROXY_SALT=0000000000000000000000000000000000000000000000000000000000000000The key and salt must match the local server's IMGPROXY_KEY / IMGPROXY_SALT.
Running Live Tests
- Start a local imgproxy server:
docker run -d -p 8081:8080 \
-e IMGPROXY_KEY=0000000000000000000000000000000000000000000000000000000000000000 \
-e IMGPROXY_SALT=0000000000000000000000000000000000000000000000000000000000000000 \
imgproxy/imgproxy- Export the environment variables and run the test suite:
export IMGPROXY_URL=http://localhost:8081
export IMGPROXY_KEY=0000000000000000000000000000000000000000000000000000000000000000
export IMGPROXY_SALT=0000000000000000000000000000000000000000000000000000000000000000
composer testWith the variables exported, the live tests run as part of the normal composer test invocation.
The Workbench Playground
The workbench/ directory contains a live review app for interactive testing. See Contributing for setup instructions.