diff options
author | Marcos Zuriaga <wolfi@wolfi.es> | 2016-10-14 23:39:06 +0300 |
---|---|---|
committer | Marcos Zuriaga <wolfi@wolfi.es> | 2016-10-14 23:39:06 +0300 |
commit | 52c072631dcbe9d0f5d16d59ea14915849a142a8 (patch) | |
tree | ce84b9d6c5e9fa84d321415858817eb00f12fe17 /lib | |
parent | 286476a546516bd03b76e7621cdfad4f01cdad15 (diff) |
Added unit tests agains sharerequest mapper
Added some helper functions on the database helper test
Renamed method so it's less confusing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Db/ShareRequestMapper.php | 4 | ||||
-rw-r--r-- | lib/Service/ShareService.php | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Db/ShareRequestMapper.php b/lib/Db/ShareRequestMapper.php index 75703019..22a69b63 100644 --- a/lib/Db/ShareRequestMapper.php +++ b/lib/Db/ShareRequestMapper.php @@ -11,6 +11,7 @@ namespace OCA\Passman\Db; use Icewind\SMB\Share; use OCA\Passman\Utility\Utils; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\Mapper; use OCP\IDBConnection; @@ -41,7 +42,7 @@ class ShareRequestMapper extends Mapper { * @param $item_guid * @return ShareRequest[] */ - public function getRequestsByItemGuid($item_guid){ + public function getRequestsByItemGuidGroupedByUser($item_guid){ $this->db->executeQuery("SET sql_mode = '';"); $q = "SELECT *, target_user_id FROM *PREFIX*" . self::TABLE_NAME . " WHERE item_guid = ? GROUP BY target_user_id;"; return $this->findEntities($q, [$item_guid]); @@ -82,6 +83,7 @@ class ShareRequestMapper extends Mapper { * Gets a share request by it's unique incremental id * @param $id * @return ShareRequest + * @throws DoesNotExistException */ public function getShareRequestById($id){ $q = "SELECT * FROM *PREFIX*" . self::TABLE_NAME . " WHERE id = ?"; diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index fbfee8c9..2866f7ff 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -216,7 +216,7 @@ class ShareService { } public function getCredentialPendingAclList($item_guid) { - return $this->shareRequest->getRequestsByItemGuid($item_guid); + return $this->shareRequest->getRequestsByItemGuidGroupedByUser($item_guid); } /** |