What's best practise when it comes to testing database transactions?
I'm using MySQL on Homestead (all works fine). But if I run Laravel's 'seeInDatabase' test locally I get a connection error. This is due to the db connection string in .env being 'localhost', not 'localhost:33060'
I assumed that by creating a .env.testing file and setting the db connection string to 'localhost:33060' PHPunit would use this to connect (but it doesn't)
I can run the tests on the VM, and they work as expected - but the notifications aren't being passed through.
I'm guessing that I'm approaching this from the wrong direction. Any help greatly appreciated.
Thanks @pixelpeter - I'm using the testing suite built into Laravel 5.1.
Adding the DB connection strings to phpunit.xml appears to have worked - but this begs the question why you would have a .env.testing file? Surely it would switch to using this configuration for the testing environment.
The next thing I'm attempting is to run the migrations on the test DB using
php artisan migrate --env=testing
But, again the env parameter is ignored and it attempts to run the migrations on the database specified in the .env file.
@JeffreyWay am I missing the point here? Thanks :)
Cheers @pixelpeter I did see someone else who had done the same, but was thinking that it didn't seem 'right' when migrate has the option to set the environment :)