I've recently pointed an existing laravel project to use a new postgres DB. The new postgres DB is maintained by a Rails API application that does all the migrations for it.
My question is with this setup, what is the best way to Unit test the laravel project. Currently all the existing unit tests are broken as they all saved to the DB with the use of
use DatabaseMigrations;
The Laravel application will not be doing migrations anymore, but is still directly accesses the DB and is not currently going through the Rails api to access the data.
Should I mock out the DB requests in my unit tests?
or
Since I can still run unit tests that hit the DB if the postgres test database is already migrated with the tables ( via the rails application migrating the test DB), is there a way to empty the DB after running the unit test without the ability drop and migrate the tables? Could I use transactions somehow and rollback all the transactions I've done in a specific unit test?
Thanks
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2xQFA4h
via IFTTT
Aucun commentaire:
Enregistrer un commentaire