Feb 28, 2019
0
Level 24
Testing DB join queries over connections with SQLite :memory: databases
In my application I have this query which uses joins over a different mysql connection.
DB::connection('tenant1')->table('stats AS t')
->select(['user_id', 'u.created_at'])
->join(config('database.connections.tenant2.database').'.users AS u', 't.user_id', '=', 'u.uid')
->whereBetween('event_date', $datesInterval)
...
It works perfectly in the application context.
But when it comes to testing. I use sqlite for each connections. And each connection uses :memory: databases.
When the test runs it tells me that it cannot find the join table : :memory:.users
Did anyone had this same issue, and a possible solution ?
Or will I be forced to use mysql for my tests too ?
Please or to participate in this conversation.