LaraNewDev's avatar

Change database just for one test (SQLite to MySQL)

Hi all, (this thread is not about setting one database for test and another for development)

I am using SQLite for testing. Everything is nice but one thing: I use one package that performs a query not supported by SQLite. One option that I have tested succesfully is changing phpunit.xml configuration to use a MySQL database during testing (separate database than dev database). After doing this, the test that was not passing is now doing so. So, fantastic. The problem? It is much much slower.

So I thought that, maybe, there is a way to use SQLite for all tests and MySQL only for that specific test. How could this be approached?

Thanks!

0 likes
3 replies
Tray2's avatar

I agree with @sinnbeck, I've have a shitload of feature tests that uses the database closer to 300 tests, and it took over 26 seconds on a MariaDB database to run them all, after installing the FastRefreshDatabase I'm down to about 7 seconds.

In my opinion it's good to run the tests on the same type of database that you are going to use in production.

1 like
LaraNewDev's avatar

Wasn't aware of the package! (it is days old :-D). Already using it, it works great!

Please or to participate in this conversation.