Hello! In order to avoid having to do too much setup, I want to disable foreign key checks in sqlite. I'm aware of the DB_FOREIGN_KEYS option inside config/database.php, but it's global and I only want them off in certain tests.
On the other hand I've tried using PRAGMA foreign_keys=off using the DB facade, but it doesn't have any visible effect. Any ideas?
@nlsnightmare Just that this is a very bad idea in my book, the constraints are there for a reason, and disabling them just cause you are lazy in setting up the world properly in your tests is just plain bad. Sooner or later you will very likely move the a MySQL database for your tests, and then your tests will fail, or you will have some inconsistencies in your data do to the tests not doing the job properly.
I want to test a very specific part of a large system, and setting up the world wouldn't really make much sense here. My test in essence is: "when you have the x data in your database, the y query should return z results". The foreign keys here might as well be strings of random values, and the logic wouldn't change a bit.