← Laravel learning pathLaravel · Module 10 of 10
Testing and deployment
Test with PHPUnit/Pest and deploy Laravel apps.
📖 Key ideas
- Feature tests call routes: $this->get("/")->assertStatus(200).
- Pest offers a cleaner syntax on PHPUnit.
- Use RefreshDatabase trait for a clean DB per test.
- Deploy: composer install --no-dev, php artisan migrate --force, config:cache.
- Hosts: Laravel Forge, Vapor, shared hosting, VPS or Docker.
💡 Real-life example: Deployment is a checklist pilots follow before take-off: install, migrate, cache, then fly.
Feature testTests a full HTTP request
PestElegant PHP testing framework
RefreshDatabaseResets DB between tests
config:cacheCaches configuration for speed