← Laravel learning path
Laravel · Module 10 of 10

Testing and deployment

Test with PHPUnit/Pest and deploy Laravel apps.

📖 Key ideas

  1. Feature tests call routes: $this->get("/")->assertStatus(200).
  2. Pest offers a cleaner syntax on PHPUnit.
  3. Use RefreshDatabase trait for a clean DB per test.
  4. Deploy: composer install --no-dev, php artisan migrate --force, config:cache.
  5. 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