I used to go with sqlite until it didn't work out. But now I use a real database from the start to make sure I don't get any false positives in my tests. I use docker for my complete dev set up
Unit testing DB
Hi All. Just wondering if I have missed something..... I am running MySQL for production, and needed to do a quick fix, which meant I added a new Scope with a
->whereRaw("DATE_FORMAT(entry_time, '%r') < ?", [$end]);
which is fine.... but then I went back to write some unit tests to complete the loop (not quite TDD, more DDT)... and eventually worked out my new found pain was because sqlite does not care for such things as DATE_FORMAT.
SO just doing a quick poll of the room... do people all start with sqlite until it no longer works (like this) and then move everything to a docker mysql (or something else).... or do people just not use sqlite for anything other than tinkering?
Just curious whatever else does.....
Thanks.
@PeterF no need for a seperate container for testing. I have just one mysql instance with 2 databases. And no need for jenkins either. I personally run github actions when I push code, but I also run my tests locally while working.
For my docker set up, I personally use something called lando. It's a wrapper around docker, that makes setting up a project a breeze. I can setup a laravel project with nginx and mysql in a couple of minutes. It even comes with a testing database by default!
I wrote a guide to get started: https://sinnbeck.dev/posts/using-lando-to-run-laravel-in-docker
Please or to participate in this conversation.