My Tests are using the trait RefreshDatabase
to "migrate fresh" before starting tests and use transactions for each testing method.
The migration works fine, but the transactions are not working at all.
I try to expose my setup:
- MariaDB 10.1 running in a docker container (I already proofed that all tables being used in my tests are in InnoDB, so transactions are supported)
- The base test class is using the
RefreshDatabase
- I tried a separate connection for testing together with
$connectionsToTransact
and also using the default connection for testing. Transaction do not work either
My setUp method:
protected function setUp()
{
parent::setUp();
Queue::fake();
}
You find the complete Test Class and Test base class in this Gist: https://gist.github.com/patriziotomato/e25de1e160dace08edefa682b64bd150
I tried to debug already and also came down to PDO something starting and rolling back a transaction, so it seems like the laravel code attempt to transact and rollback, but it does not have any affect in my tests.
I need ideas what else could go wrong
setUp()
andtearDown()
where needed? – LatviasetUp()
method to my original question – Schaffhausensqlite
instead of a proper db? – UranoRefreshDatabase
in tests. Try upgrading to the latest version of 5.6 – Indigested