Skip to content

Conversation

AbdulrahmanReda70
Copy link
Contributor

Summary

Replaces DatabaseMigrations with RefreshDatabase across all test files for significant performance improvement while maintaining test isolation and reliability.

Why the Change?

DatabaseMigrations was very slow because:

  • Runs php artisan migrate:fresh --seed for every single test
  • Tears down and rebuilds database schema for each individual test
  • Massive I/O overhead with no reuse

RefreshDatabase is faster because:

  • Sets up database schema once at start
  • Uses transactions that auto-rollback after each test
  • Laravel's recommended approach for testing

Safety ✅

  • All integration tests still pass
  • Same test isolation guarantees
  • No breaking changes
  • Follows Laravel best practices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant