I've heard it's quite a good idea to test your application in production, what is something I can agree on, since it's a different environment. But the thing is, how to run tests if my application already has some data in the DB? Because of the DatabaseRefresh, everything will be deleted, and without it useless data will be persisted there.
Most tests I worry about is looking for places to refactor code, just my opinion but I would not worry about certain tests in production. And if you do test make sure to back up everything meaning your data first.
Not sure where you heard this, but testing in production is generally a bad idea.
A good test suite ran locally, or in a continuous integration environment does the job most of the time.
Oh, and by the way, to avoid screwing up any database with fake data, you can use the DatabaseTransaction trait in your TestCase class (instead of RefreshDatabase). You can also run your tests on a different database if you change DB_DATABASE in your phpunit.xml file.
@benjamincrozat Thanks for the tip! The two databases idea seems good. I already have two DBs for my tests locally, so applying that to the production environment seem nice.
And since we're talking about phpunit.xml, whenever I run my tests I use the test_db, and when I want to use my system I'd like to use my normal DB, which I can't, because if I run my migrations a connection error is risen. Any idea if I am doing somethinf wrong in the configurations?