diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-26 13:07:12 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-26 14:40:23 +0200 |
commit | f4fd0224db82b1bab3e7f661686718fa9aebdf3b (patch) | |
tree | cf48b9c0f9877e5d6842838df17463a0e11c87c2 /apps/files_sharing/tests | |
parent | e2b44d199bea7da74811689ec3ab787135e22de6 (diff) | |
download | nextcloud-server-f4fd0224db82b1bab3e7f661686718fa9aebdf3b.tar.gz nextcloud-server-f4fd0224db82b1bab3e7f661686718fa9aebdf3b.zip |
Do not use \OCP\DB anymore
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
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; |