diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:02 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:19 +0100 |
commit | f0c6cfde3afd25f56f399a3d0afa47281ab11833 (patch) | |
tree | 538277d32bbc4d17c2825ce62ce719a7ce07827a /tests/lib | |
parent | dc00c8ac31793f8facb6dbb764820dbe06786679 (diff) | |
download | nextcloud-server-f0c6cfde3afd25f56f399a3d0afa47281ab11833.tar.gz nextcloud-server-f0c6cfde3afd25f56f399a3d0afa47281ab11833.zip |
Rollback failed transactions in TestCase.php to not break followup tests
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/TestCase.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 69cf2a39792..6cadf9693c3 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -261,7 +261,12 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { } $dataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data-autotest'); if (self::$wasDatabaseAllowed && \OC::$server->getDatabaseConnection()) { - $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $db = \OC::$server->getDatabaseConnection(); + if ($db->inTransaction()) { + $db->rollBack(); + throw new \Exception('There was a transaction still in progress and needed to be rolled back. Please fix this in your test.'); + } + $queryBuilder = $db->getQueryBuilder(); self::tearDownAfterClassCleanShares($queryBuilder); self::tearDownAfterClassCleanStorages($queryBuilder); |