summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-05 11:00:34 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-05 11:00:34 +0200
commit34951efed645075390ddfec46ac4427393324f23 (patch)
tree499e168e12e4e073f0bd328e86c40d805829a66d /tests
parent710b7dd81c4c4cd84e0d3024fcdcc1bf150b5137 (diff)
parent42b29e39c12fc4384b643216f9bc45a924af87cb (diff)
downloadnextcloud-server-34951efed645075390ddfec46ac4427393324f23.tar.gz
nextcloud-server-34951efed645075390ddfec46ac4427393324f23.zip
Merge pull request #19574 from owncloud/fix-sharing-tests-assuming-empty-share-table
Clear the shares after the test like storages and files
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/testcase.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php
index 7e4890a46c2..8cfa2a72598 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/testcase.php
@@ -24,6 +24,7 @@ namespace Test;
use OC\Command\QueueBus;
use OC\Files\Filesystem;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Security\ISecureRandom;
abstract class TestCase extends \PHPUnit_Framework_TestCase {
@@ -129,9 +130,11 @@ 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();
- self::tearDownAfterClassCleanStorages();
- self::tearDownAfterClassCleanFileCache();
+ self::tearDownAfterClassCleanShares($queryBuilder);
+ self::tearDownAfterClassCleanStorages($queryBuilder);
+ self::tearDownAfterClassCleanFileCache($queryBuilder);
self::tearDownAfterClassCleanStrayDataFiles($dataDir);
self::tearDownAfterClassCleanStrayHooks();
self::tearDownAfterClassCleanStrayLocks();
@@ -140,25 +143,33 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
}
/**
+ * Remove all entries from the share table
+ *
+ * @param IQueryBuilder $queryBuilder
+ */
+ static protected function tearDownAfterClassCleanShares(IQueryBuilder $queryBuilder) {
+ $queryBuilder->delete('share')
+ ->execute();
+ }
+
+ /**
* Remove all entries from the storages table
*
- * @throws \OC\DatabaseException
+ * @param IQueryBuilder $queryBuilder
*/
- static protected function tearDownAfterClassCleanStorages() {
- $sql = 'DELETE FROM `*PREFIX*storages`';
- $query = \OC_DB::prepare($sql);
- $query->execute();
+ static protected function tearDownAfterClassCleanStorages(IQueryBuilder $queryBuilder) {
+ $queryBuilder->delete('storages')
+ ->execute();
}
/**
* Remove all entries from the filecache table
*
- * @throws \OC\DatabaseException
+ * @param IQueryBuilder $queryBuilder
*/
- static protected function tearDownAfterClassCleanFileCache() {
- $sql = 'DELETE FROM `*PREFIX*filecache`';
- $query = \OC_DB::prepare($sql);
- $query->execute();
+ static protected function tearDownAfterClassCleanFileCache(IQueryBuilder $queryBuilder) {
+ $queryBuilder->delete('filecache')
+ ->execute();
}
/**