Only perform tearDown operations on the database if we have a connection to it .....

This commit is contained in:
Thomas Müller 2015-12-17 17:29:50 +01:00
parent 8f6a257f1b
commit 2709244acd
1 changed files with 6 additions and 4 deletions

View File

@ -156,11 +156,13 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
public static function tearDownAfterClass() {
$dataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data-autotest');
$queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
if (\OC::$server->getDatabaseConnection()) {
$queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
self::tearDownAfterClassCleanShares($queryBuilder);
self::tearDownAfterClassCleanStorages($queryBuilder);
self::tearDownAfterClassCleanFileCache($queryBuilder);
self::tearDownAfterClassCleanShares($queryBuilder);
self::tearDownAfterClassCleanStorages($queryBuilder);
self::tearDownAfterClassCleanFileCache($queryBuilder);
}
self::tearDownAfterClassCleanStrayDataFiles($dataDir);
self::tearDownAfterClassCleanStrayHooks();
self::tearDownAfterClassCleanStrayLocks();