My test suite currently has 67 tests and 167 assertions. If I run the tests in a SQLite memory database, the tests run in less than 20 seconds. If I run them in MySQL, they take nearly two minutes, so I'd prefer to run all the tests that I can using the SQLite memory database.
However, I have a table that contains spatial data, and SQLite doesn't support spatial data. I want to run tests on that model and table using the MySQL driver. Can I specify the MySQL database connection for an individual unit test while running the rest in SQLite?
You could probably just do like Config::set('database.default', 'mysql');
in that/those test(s).
Just a note for anybody else who wants to use this method, this is how I setup the test:
if (Config::get('database.default') == 'sqlite')
{
Config::set('database.default', 'mysql');
Artisan::call('migrate:refresh');
}
Works great, thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community