[13.x] Roll back all transaction levels after each test in `RefreshDatabase`

Merged
XU
10d ago
+19-1

If a test leaves a transaction open, RefreshDatabase only rolls back one level and the test transaction stays open. With in-memory SQLite the same connection is reused for the next test, so its BEGIN fails, and so does every test after it:

PDOException: SQLSTATE[HY000]: General error: 1 cannot start a transaction within a transaction

On MySQL the rollback can fail with SAVEPOINT trans2 does not exist instead.

This rolls back to level 0.