diff options
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/ShareTest.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/TestCase.php | 24 |
2 files changed, 12 insertions, 16 deletions
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 9b60255ed97..ca649768d71 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -63,10 +63,6 @@ class ShareTest extends TestCase { self::$tempStorage = null; - // clear database table - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`'); - $query->execute(); - parent::tearDown(); } diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 3b1ccb71a94..e49b696e68a 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -120,8 +120,9 @@ abstract class TestCase extends \Test\TestCase { } protected function tearDown() { - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`'); - $query->execute(); + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $qb->delete('share'); + $qb->execute(); parent::tearDown(); } @@ -206,16 +207,15 @@ abstract class TestCase extends \Test\TestCase { * @return array with: item_source, share_type, share_with, item_type, permissions */ protected function getShareFromId($shareID) { - $sql = 'SELECT `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?'; - $args = array($shareID); - $query = \OCP\DB::prepare($sql); - $result = $query->execute($args); - - $share = Null; - - if ($result) { - $share = $result->fetchRow(); - } + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $qb->select('item_source', '`share_type', 'share_with', 'item_type', 'permissions') + ->from('share') + ->where( + $qb->expr()->eq('id', $qb->createNamedParameter($shareID)) + ); + $result = $qb->execute(); + $share = $result->fetch(); + $result->closeCursor(); return $share; |