diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-10-31 14:19:34 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-11-01 19:54:41 +0100 |
commit | 16ec0f2177edf2d9dcda43e51d604a0155767f47 (patch) | |
tree | 34ebdf75708d447210b8a5d8b28423d00ab63a07 /apps/sharebymail/lib | |
parent | 86b362809bb58c12864fce93af9c6e961bb7301d (diff) | |
download | nextcloud-server-16ec0f2177edf2d9dcda43e51d604a0155767f47.tar.gz nextcloud-server-16ec0f2177edf2d9dcda43e51d604a0155767f47.zip |
add tests for the share-by-mail provider
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 46697910bbc..6be46f747e6 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -142,7 +142,7 @@ class ShareByMailProvider implements IShareProvider { * @return int * @throws \Exception */ - private function createMailShare(IShare $share) { + protected function createMailShare(IShare $share) { $share->setToken($this->generateToken()); $shareId = $this->addShareToDB( $share->getNodeId(), @@ -176,7 +176,7 @@ class ShareByMailProvider implements IShareProvider { } - private function sendMailNotification($filename, $link, $owner, $initiator, $shareWith) { + protected function sendMailNotification($filename, $link, $owner, $initiator, $shareWith) { if ($owner === $initiator) { $subject = (string)$this->l->t('%s shared »%s« with you', array($owner, $filename)); } else { @@ -227,7 +227,7 @@ class ShareByMailProvider implements IShareProvider { * * @return string */ - public function generateToken() { + protected function generateToken() { $token = $this->secureRandom->generate( 15, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); return $token; @@ -270,7 +270,7 @@ class ShareByMailProvider implements IShareProvider { * @param string $token * @return int */ - private function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token) { + protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token) { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert('share') ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL)) @@ -528,7 +528,7 @@ class ShareByMailProvider implements IShareProvider { * * @param string $shareId */ - private function removeShareFromTable($shareId) { + protected function removeShareFromTable($shareId) { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId))); @@ -543,7 +543,7 @@ class ShareByMailProvider implements IShareProvider { * @throws InvalidShare * @throws ShareNotFound */ - private function createShareObject($data) { + protected function createShareObject($data) { $share = new Share($this->rootFolder, $this->userManager); $share->setId((int)$data['id']) @@ -613,7 +613,7 @@ class ShareByMailProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(Share::SHARE_TYPE_REMOTE))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL))) ->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid))) ->execute(); } @@ -644,7 +644,7 @@ class ShareByMailProvider implements IShareProvider { * @return array * @throws ShareNotFound */ - private function getRawShare($id) { + protected function getRawShare($id) { // Now fetch the inserted share and create a complete share object $qb = $this->dbConnection->getQueryBuilder(); |