diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-04-20 20:37:27 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-04-20 20:37:27 +0200 |
commit | cd01c440a01744d666df275cb7941fa29d2283dd (patch) | |
tree | d09caccace60dcfcc42e9b00ae2d810ec29643cc /apps/files_trashbin | |
parent | cdcabbd0b3f6209b2a312b30a84c381f125bcf68 (diff) | |
parent | b53d6598f10c97318fbf065369f5b097eb134e28 (diff) | |
download | nextcloud-server-cd01c440a01744d666df275cb7941fa29d2283dd.tar.gz nextcloud-server-cd01c440a01744d666df275cb7941fa29d2283dd.zip |
Merge pull request #23919 from owncloud/cyclyc-share-dep-example
SharedStorage to new sharing code + cleanup
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/tests/storage.php | 22 | ||||
-rw-r--r-- | apps/files_trashbin/tests/trashbin.php | 11 |
2 files changed, 24 insertions, 9 deletions
diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php index afc07ff36c8..5c631770da3 100644 --- a/apps/files_trashbin/tests/storage.php +++ b/apps/files_trashbin/tests/storage.php @@ -261,9 +261,14 @@ class Storage extends \Test\TestCase { $recipientUser = $this->getUniqueId('recipient_'); \OC::$server->getUserManager()->createUser($recipientUser, $recipientUser); - $fileinfo = $this->userView->getFileInfo('share'); - $this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, - $recipientUser, 31)); + $node = \OC::$server->getUserFolder($this->user)->get('share'); + $share = \OC::$server->getShareManager()->newShare(); + $share->setNode($node) + ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setSharedBy($this->user) + ->setSharedWith($recipientUser) + ->setPermissions(\OCP\Constants::PERMISSION_ALL); + \OC::$server->getShareManager()->createShare($share); $this->loginAsUser($recipientUser); @@ -309,9 +314,14 @@ class Storage extends \Test\TestCase { $recipientUser = $this->getUniqueId('recipient_'); \OC::$server->getUserManager()->createUser($recipientUser, $recipientUser); - $fileinfo = $this->userView->getFileInfo('share'); - $this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, - $recipientUser, 31)); + $node = \OC::$server->getUserFolder($this->user)->get('share'); + $share = \OC::$server->getShareManager()->newShare(); + $share->setNode($node) + ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setSharedBy($this->user) + ->setSharedWith($recipientUser) + ->setPermissions(\OCP\Constants::PERMISSION_ALL); + \OC::$server->getShareManager()->createShare($share); $this->loginAsUser($recipientUser); diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php index 8d616b6e8e2..7087da37266 100644 --- a/apps/files_trashbin/tests/trashbin.php +++ b/apps/files_trashbin/tests/trashbin.php @@ -211,9 +211,14 @@ class Test_Trashbin extends \Test\TestCase { \OC\Files\Filesystem::file_put_contents($folder . 'user1-4.txt', 'file4'); //share user1-4.txt with user2 - $fileInfo = \OC\Files\Filesystem::getFileInfo($folder); - $result = \OCP\Share::shareItem('folder', $fileInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_TRASHBIN_USER2, 31); - $this->assertTrue($result); + $node = \OC::$server->getUserFolder(self::TEST_TRASHBIN_USER1)->get($folder); + $share = \OC::$server->getShareManager()->newShare(); + $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setNode($node) + ->setSharedBy(self::TEST_TRASHBIN_USER1) + ->setSharedWith(self::TEST_TRASHBIN_USER2) + ->setPermissions(\OCP\Constants::PERMISSION_ALL); + \OC::$server->getShareManager()->createShare($share); // delete them so that they end up in the trash bin \OC\Files\Filesystem::unlink($folder . 'user1-1.txt'); |