A sample Laravel project set-up to switch database when on test mode vs app mode.
luisjg/database-test-switching
This is a sample repo that illustrates how to configure Laravel to tell PHPUnit to test against a smaller local database while still using the real database when the application is being served.
PHPMIT