Testing
Backend (Pest + PHPUnit)
- Location:
tests/Feature/andtests/Unit/. - Feature tests: Use
assertInertia()->component('blog/Index')etc.; the component path is resolved byApp\Core\Inertia\TestingViewFinder. For feature-flagged routes, activate the flag in the test (e.g.Feature::activate('blog')). - Cache: Use the model’s cache-key helpers in assertions (e.g.
Setting::siteCacheKey(),Page::slugCacheKey('slug')) as intests/Feature/ContentCacheInvalidationTest.php. - Run:
php artisan testorphp artisan test --compact --filter=TestName.
Frontend
- Unit/component: Jest + React Testing Library in
resources/js/__tests__/(or project convention). Mock Zustand and i18next as needed. - E2E: Playwright via the Pest browser plugin; run with the PHP test suite for consistency.
Before submitting
Run vendor/bin/pint --test --format agent, vendor/bin/phpstan analyse, npm run format:check, npm run lint, npm run types, and php artisan test. These are also run in CI.