summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/tests/ApiTest.php49
-rw-r--r--apps/files_sharing/tests/CacheTest.php27
-rw-r--r--apps/files_sharing/tests/EtagPropagationTest.php20
-rw-r--r--apps/files_sharing/tests/GroupEtagPropagationTest.php9
-rw-r--r--apps/files_sharing/tests/PermissionsTest.php9
-rw-r--r--apps/files_sharing/tests/ShareTest.php6
-rw-r--r--apps/files_sharing/tests/SharedMountTest.php16
-rw-r--r--apps/files_sharing/tests/SharedStorageTest.php4
-rw-r--r--apps/files_sharing/tests/TestCase.php5
-rw-r--r--apps/files_sharing/tests/WatcherTest.php5
-rw-r--r--apps/files_trashbin/tests/StorageTest.php6
-rw-r--r--apps/files_trashbin/tests/TrashbinTest.php3
-rw-r--r--apps/files_versions/tests/VersioningTest.php7
13 files changed, 138 insertions, 28 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index 0616daed62d..5cf3906e565 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -42,6 +42,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IServerContainer;
+use OCP\Share\IShare;
/**
* Class ApiTest
@@ -384,6 +385,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(19);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$node2 = $this->userFolder->get($this->folder);
$share2 = $this->shareManager->newShare();
@@ -393,6 +396,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result = $ocs->getShares('true');
@@ -619,6 +624,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$node2 = $this->userFolder->get($this->folder.'/'.$this->filename);
$share2 = $this->shareManager->newShare();
@@ -627,6 +634,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
$node3 = $this->userFolder->get($this->folder.'/'.$this->subfolder.'/'.$this->filename);
$share3 = $this->shareManager->newShare();
@@ -635,6 +644,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share3 = $this->shareManager->createShare($share3);
+ $share3->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share3);
$testValues=array(
array('query' => $this->folder,
@@ -642,8 +653,8 @@ class ApiTest extends TestCase {
array('query' => $this->folder . $this->subfolder,
'expectedResult' => $this->folder . $this->subfolder . $this->filename),
);
- foreach ($testValues as $value) {
+ foreach ($testValues as $value) {
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result = $ocs->getShares('false', 'false', 'true', $value['query']);
$ocs->cleanup();
@@ -673,6 +684,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$node2 = \OC::$server->getRootFolder()->getUserFolder(self::TEST_FILES_SHARING_API_USER2)->get($this->subfolder);
$share2 = $this->shareManager->newShare();
@@ -681,6 +694,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$result = $ocs->getShares();
@@ -789,6 +804,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$node2 = $this->userFolder->get($this->folder);
$share2 = $this->shareManager->newShare();
@@ -798,6 +815,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
$share3 = $this->shareManager->newShare();
$share3->setNode($node1)
@@ -805,6 +824,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share3 = $this->shareManager->createShare($share3);
+ $share3->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share3);
// $request = $this->createRequest(['path' => $this->subfolder]);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
@@ -847,6 +868,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$user2Folder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER2);
$node2 = $user2Folder->get($this->subfolder . $this->filename);
@@ -857,6 +880,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(19);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
$user3Folder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER3);
$node3 = $user3Folder->get($this->filename);
@@ -866,6 +891,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share3 = $this->shareManager->createShare($share3);
+ $share3->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share3);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3);
$result = $ocs->getShares();
@@ -993,6 +1020,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$config = \OC::$server->getConfig();
@@ -1098,6 +1127,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setPermissions(31);
$share1 = $this->shareManager->createShare($share1);
+ $share1->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share1);
$user2folder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER2);
$node2 = $user2folder->get($this->folder.'/'.$this->filename);
@@ -1107,6 +1138,8 @@ class ApiTest extends TestCase {
->setShareType(\OCP\Share::SHARE_TYPE_LINK)
->setPermissions(1);
$share2 = $this->shareManager->createShare($share2);
+ $share2->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share2);
// test if we can unshare the link again
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
@@ -1131,6 +1164,8 @@ class ApiTest extends TestCase {
self::TEST_FILES_SHARING_API_USER2,
\OCP\Constants::PERMISSION_ALL
);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
// user2 shares a file from the folder as link
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -1203,6 +1238,8 @@ class ApiTest extends TestCase {
self::TEST_FILES_SHARING_API_USER2,
\OCP\Constants::PERMISSION_ALL
);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
// user2: check that mount point name appears correctly
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -1357,6 +1394,10 @@ class ApiTest extends TestCase {
$topId = $data['id'];
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
+ $ocs->acceptShare($topId);
+ $ocs->cleanup();
+
+ $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
$ocs->cleanup();
@@ -1385,6 +1426,12 @@ class ApiTest extends TestCase {
$topId = $data['id'];
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
+ $ocs->acceptShare($topId);
+ $ocs->cleanup();
+
+ \OC_Util::tearDownFS();
+
+ $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
$ocs->cleanup();
diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php
index 7bcb707a82b..e8d8ae7f63b 100644
--- a/apps/files_sharing/tests/CacheTest.php
+++ b/apps/files_sharing/tests/CacheTest.php
@@ -33,6 +33,7 @@ namespace OCA\Files_Sharing\Tests;
use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\Jail;
use OCA\Files_Sharing\SharedStorage;
+use OCP\Share\IShare;
/**
* Class CacheTest
@@ -103,7 +104,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
$node = $rootFolder->get('container/shared single file.txt');
$share = $this->shareManager->newShare();
@@ -112,7 +115,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE));
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
// login as user2
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -313,6 +318,8 @@ class CacheTest extends TestCase {
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
@@ -396,7 +403,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
\OC_Util::tearDownFS();
@@ -427,7 +436,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -454,7 +465,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
\OC_Util::tearDownFS();
list($sourceStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
@@ -489,7 +502,9 @@ class CacheTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php
index 4aba9e29113..ee4ee19ce9f 100644
--- a/apps/files_sharing/tests/EtagPropagationTest.php
+++ b/apps/files_sharing/tests/EtagPropagationTest.php
@@ -78,23 +78,28 @@ class EtagPropagationTest extends PropagationTestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
$node = $rootFolder->getUserFolder(self::TEST_FILES_SHARING_API_USER1)
->get('/sub1/sub2/folder');
+
$share = $shareManager->newShare();
$share->setNode($node)
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
+
$share = $shareManager->newShare();
$share->setNode($node)
->setShareType(\OCP\Share::SHARE_TYPE_USER)
->setSharedWith(self::TEST_FILES_SHARING_API_USER3)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER3);
$folderInfo = $view1->getFileInfo('/directReshare');
$this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo);
@@ -107,7 +112,8 @@ class EtagPropagationTest extends PropagationTestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
$this->fileIds[self::TEST_FILES_SHARING_API_USER1][''] = $view1->getFileInfo('')->getId();
$this->fileIds[self::TEST_FILES_SHARING_API_USER1]['sub1'] = $view1->getFileInfo('sub1')->getId();
@@ -131,7 +137,8 @@ class EtagPropagationTest extends PropagationTestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER4)
->setSharedBy(self::TEST_FILES_SHARING_API_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
$folderInfo = $view2->getFileInfo('/directReshare');
$this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo);
@@ -144,7 +151,8 @@ class EtagPropagationTest extends PropagationTestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER4)
->setSharedBy(self::TEST_FILES_SHARING_API_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $shareManager->createShare($share);
+ $share = $shareManager->createShare($share);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
$this->fileIds[self::TEST_FILES_SHARING_API_USER2][''] = $view2->getFileInfo('')->getId();
$this->fileIds[self::TEST_FILES_SHARING_API_USER2]['sub1'] = $view2->getFileInfo('sub1')->getId();
diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php
index 206980659c7..3304bf966bb 100644
--- a/apps/files_sharing/tests/GroupEtagPropagationTest.php
+++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php
@@ -52,13 +52,14 @@ class GroupEtagPropagationTest extends PropagationTestCase {
$view1 = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
$view1->mkdir('/test/sub');
- $this->share(
+ $share = $this->share(
\OCP\Share::SHARE_TYPE_GROUP,
'/test',
self::TEST_FILES_SHARING_API_USER1,
'group1',
\OCP\Constants::PERMISSION_ALL
);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
$this->fileIds[self::TEST_FILES_SHARING_API_USER1][''] = $view1->getFileInfo('')->getId();
$this->fileIds[self::TEST_FILES_SHARING_API_USER1]['test'] = $view1->getFileInfo('test')->getId();
$this->fileIds[self::TEST_FILES_SHARING_API_USER1]['test/sub'] = $view1->getFileInfo('test/sub')->getId();
@@ -66,20 +67,22 @@ class GroupEtagPropagationTest extends PropagationTestCase {
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
$view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
- $this->share(
+ $share = $this->share(
\OCP\Share::SHARE_TYPE_GROUP,
'/test',
self::TEST_FILES_SHARING_API_USER2,
'group2',
\OCP\Constants::PERMISSION_ALL
);
- $this->share(
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER3);
+ $share = $this->share(
\OCP\Share::SHARE_TYPE_GROUP,
'/test/sub',
self::TEST_FILES_SHARING_API_USER2,
'group3',
\OCP\Constants::PERMISSION_ALL
);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER4);
$this->fileIds[self::TEST_FILES_SHARING_API_USER2][''] = $view2->getFileInfo('')->getId();
$this->fileIds[self::TEST_FILES_SHARING_API_USER2]['test'] = $view2->getFileInfo('test')->getId();
diff --git a/apps/files_sharing/tests/PermissionsTest.php b/apps/files_sharing/tests/PermissionsTest.php
index 5c0086646de..05a83302566 100644
--- a/apps/files_sharing/tests/PermissionsTest.php
+++ b/apps/files_sharing/tests/PermissionsTest.php
@@ -31,6 +31,7 @@ namespace OCA\Files_Sharing\Tests;
use OC\Files\Cache\Cache;
use OC\Files\Storage\Storage;
use OC\Files\View;
+use OCP\Share\IShare;
/**
* Class PermissionsTest
@@ -89,7 +90,9 @@ class PermissionsTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
$node = $rootFolder->get('container/shareddirrestricted');
$share = $this->shareManager->newShare();
@@ -98,7 +101,9 @@ class PermissionsTest extends TestCase {
->setSharedWith(self::TEST_FILES_SHARING_API_USER2)
->setSharedBy(self::TEST_FILES_SHARING_API_USER1)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
- $this->shareManager->createShare($share);
+ $share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
// login as user2
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php
index f89f478a97a..61bec2caea3 100644
--- a/apps/files_sharing/tests/ShareTest.php
+++ b/apps/files_sharing/tests/ShareTest.php
@@ -91,6 +91,8 @@ class ShareTest extends TestCase {
'testGroup',
\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
);
+ $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER2);
+ $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER3);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
@@ -176,14 +178,14 @@ class ShareTest extends TestCase {
$share = $shares[0];
$this->assertSame('/test.txt' ,$share->getTarget());
$this->assertSame(19, $share->getPermissions());
-
+
\OC\Files\Filesystem::rename('test.txt', 'new test.txt');
$shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_GROUP);
$share = $shares[0];
$this->assertSame('/new test.txt' ,$share->getTarget());
$this->assertSame(19, $share->getPermissions());
-
+
$share->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE);
$this->shareManager->updateShare($share);
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index 1eddbcb64f7..f01e9896efb 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -87,6 +87,7 @@ class SharedMountTest extends TestCase {
self::TEST_FILES_SHARING_API_USER1,
self::TEST_FILES_SHARING_API_USER2,
\OCP\Constants::PERMISSION_ALL);
+ $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER2);
$share->setTarget('/foo/bar' . $this->folder);
$this->shareManager->moveShare($share, self::TEST_FILES_SHARING_API_USER2);
@@ -200,6 +201,9 @@ class SharedMountTest extends TestCase {
'testGroup',
\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE
);
+ $this->shareManager->acceptShare($share, $user1->getUID());
+ $this->shareManager->acceptShare($share, $user2->getUID());
+ $this->shareManager->acceptShare($share, $user3->getUID());
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -284,7 +288,7 @@ class SharedMountTest extends TestCase {
if ($before === $after) { continue; }
$data[] = [
- 'file',
+ 'file',
$before,
$after,
];
@@ -348,6 +352,9 @@ class SharedMountTest extends TestCase {
'testGroup',
$beforePerm
);
+ $this->shareManager->acceptShare($share, $user1->getUID());
+ $this->shareManager->acceptShare($share, $user2->getUID());
+ $this->shareManager->acceptShare($share, $user3->getUID());
// Login as user 2 and verify the item exists
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -386,7 +393,7 @@ class SharedMountTest extends TestCase {
}
/**
- * If the permissions on a group share are upgraded be sure to still respect
+ * If the permissions on a group share are upgraded be sure to still respect
* removed shares by a member of that group
*/
public function testPermissionUpgradeOnUserDeletedGroupShare() {
@@ -409,6 +416,9 @@ class SharedMountTest extends TestCase {
'testGroup',
\OCP\Constants::PERMISSION_READ
);
+ $this->shareManager->acceptShare($share, $user1->getUID());
+ $this->shareManager->acceptShare($share, $user2->getUID());
+ $this->shareManager->acceptShare($share, $user3->getUID());
// Login as user 2 and verify the item exists
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -430,7 +440,7 @@ class SharedMountTest extends TestCase {
$share->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = $this->shareManager->updateShare($share);
- // Login as user 2 and verify
+ // Login as user 2 and verify
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
$result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php
index c443aa9c45f..b26af57fc11 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -283,7 +283,7 @@ class SharedStorageTest extends TestCase {
$this->assertFalse($user2View->rename($this->folder . '/test-create.txt', $this->folder . '/newtarget.txt'));
$this->assertFalse($user2View->file_exists($this->folder . '/newtarget.txt'));
- // rename file not allowed if target exists
+ // rename file not allowed if target exists
$this->assertFalse($user2View->rename($this->folder . '/newtarget.txt', $this->folder . '/existing.txt'));
// overwriting file not allowed
@@ -507,6 +507,7 @@ class SharedStorageTest extends TestCase {
self::TEST_FILES_SHARING_API_GROUP1,
\OCP\Constants::PERMISSION_ALL
);
+ $this->shareManager->acceptShare($share1, self::TEST_FILES_SHARING_API_USER2);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -519,6 +520,7 @@ class SharedStorageTest extends TestCase {
self::TEST_FILES_SHARING_API_GROUP1,
\OCP\Constants::PERMISSION_ALL
);
+ $this->shareManager->acceptShare($share2, self::TEST_FILES_SHARING_API_USER2);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$view2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php
index e49b696e68a..6c5f078f9e7 100644
--- a/apps/files_sharing/tests/TestCase.php
+++ b/apps/files_sharing/tests/TestCase.php
@@ -34,6 +34,7 @@ namespace OCA\Files_Sharing\Tests;
use OC\Files\Cache\Scanner;
use OC\Files\Filesystem;
use OCA\Files_Sharing\AppInfo\Application;
+use OCP\Share\IShare;
use Test\Traits\MountProviderTrait;
/**
@@ -72,7 +73,7 @@ abstract class TestCase extends \Test\TestCase {
$application = new Application();
$application->registerMountProviders();
-
+
// reset backend
\OC_User::clearBackends();
\OC::$server->getGroupManager()->clearBackends();
@@ -240,6 +241,8 @@ abstract class TestCase extends \Test\TestCase {
->setNode($node)
->setPermissions($permissions);
$share = $this->shareManager->createShare($share);
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $share = $this->shareManager->updateShare($share);
return $share;
}
diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php
index e6ca5f40a8f..59f84057a14 100644
--- a/apps/files_sharing/tests/WatcherTest.php
+++ b/apps/files_sharing/tests/WatcherTest.php
@@ -29,6 +29,8 @@
namespace OCA\Files_Sharing\Tests;
+use OCP\Share\IShare;
+
/**
* Class WatcherTest
*
@@ -74,6 +76,9 @@ class WatcherTest extends TestCase {
\OCP\Constants::PERMISSION_ALL
);
+ $this->_share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($this->_share);
+
// login as user2
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index 3c660134d1c..7632915e002 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -282,7 +282,8 @@ class StorageTest extends \Test\TestCase {
->setSharedBy($this->user)
->setSharedWith($recipientUser)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- \OC::$server->getShareManager()->createShare($share);
+ $share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, $recipientUser);
$this->loginAsUser($recipientUser);
@@ -335,7 +336,8 @@ class StorageTest extends \Test\TestCase {
->setSharedBy($this->user)
->setSharedWith($recipientUser)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- \OC::$server->getShareManager()->createShare($share);
+ $share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, $recipientUser);
$this->loginAsUser($recipientUser);
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index 22b6e87317c..3b1fff31fe1 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -227,7 +227,8 @@ class TrashbinTest extends \Test\TestCase {
->setSharedBy(self::TEST_TRASHBIN_USER1)
->setSharedWith(self::TEST_TRASHBIN_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
- \OC::$server->getShareManager()->createShare($share);
+ $share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_TRASHBIN_USER2);
// delete them so that they end up in the trash bin
\OC\Files\Filesystem::unlink($folder . 'user1-1.txt');
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index b35eb9a62c0..b3023dbef65 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -37,6 +37,7 @@ require_once __DIR__ . '/../appinfo/app.php';
use OC\Files\Storage\Temporary;
use OCP\IConfig;
+use OCP\Share\IShare;
/**
* Class Test_Files_versions
@@ -325,6 +326,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
self::loginHelper(self::TEST_VERSIONS_USER2);
@@ -393,6 +395,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
self::loginHelper(self::TEST_VERSIONS_USER2);
$versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions';
@@ -442,6 +445,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
self::loginHelper(self::TEST_VERSIONS_USER2);
$versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions';
@@ -509,6 +513,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
self::loginHelper(self::TEST_VERSIONS_USER2);
@@ -653,6 +658,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
$versions = $this->createAndCheckVersions(
\OC\Files\Filesystem::getView(),
@@ -823,6 +829,7 @@ class VersioningTest extends \Test\TestCase {
->setSharedWith(self::TEST_VERSIONS_USER2)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share = \OC::$server->getShareManager()->createShare($share);
+ \OC::$server->getShareManager()->acceptShare($share, self::TEST_VERSIONS_USER2);
$this->loginAsUser(self::TEST_VERSIONS_USER2);