diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-05 10:13:45 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-05 10:13:45 +0200 |
commit | 42b29e39c12fc4384b643216f9bc45a924af87cb (patch) | |
tree | 52d56f94afe71ee3826a3a6c8504bd4640be404b /tests | |
parent | bc593f79214e85b971b48a980e43e9b4b64e7e93 (diff) | |
download | nextcloud-server-42b29e39c12fc4384b643216f9bc45a924af87cb.tar.gz nextcloud-server-42b29e39c12fc4384b643216f9bc45a924af87cb.zip |
Clear the shares after the test like storages and files
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/testcase.php | 35 |
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(); } /** |