jeudi 1 avril 2021

Use custom testing model in Laravel 7 tests

I'm writing a basic repository with basic methods, to have it extended from other repositories, e.g.:

BaseRepository
  ├─ UserRepository
  ├─ PostRepository
  └─ CommentRepository

I want to test my BaseRepository with a custom testing model, not with an actual application model (e.g. User, Post, etc), so i need to create this custom model with its migration and use them only during testing, but i'd prefer putting tose files into tests folder to keep the structure clean.

Is there a way to tell laravel to load other migrations other those in app/database/migrations only during testing?

Aucun commentaire:

Enregistrer un commentaire