summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-09-08 20:15:35 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-09-08 20:15:47 -0400
commitf23f719d99f43138739d3a77e2d63fede43e9687 (patch)
tree9e548879a5845617bab80ae2b2f7ffeb801424fa /tests
parent5e790368bc72167eb3c390cc43d00956714d7fff (diff)
downloadnextcloud-server-f23f719d99f43138739d3a77e2d63fede43e9687.tar.gz
nextcloud-server-f23f719d99f43138739d3a77e2d63fede43e9687.zip
Fix unsharing from self for group shares and add test for it
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share/share.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index b45779038ba..b2fecdc8bf7 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -249,6 +249,7 @@ class Test_Share extends UnitTestCase {
$this->assertTrue(in_array('test1.txt', $to_test));
// Remove user
+ OC_User::setUserId($this->user1);
OC_User::deleteUser($this->user1);
OC_User::setUserId($this->user2);
$this->assertEqual(OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET), array('test1.txt'));
@@ -383,8 +384,15 @@ class Test_Share extends UnitTestCase {
OC_Group::addToGroup($this->user4, $this->group1);
$this->assertEqual(OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET), array('test.txt'));
+ // Unshare from self
+ $this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt'));
+ $this->assertEqual(OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET), array());
+ OC_User::setUserId($this->user2);
+ $this->assertEqual(OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET), array('test.txt'));
+
// Remove group
OC_Group::deleteGroup($this->group1);
+ OC_User::setUserId($this->user4);
$this->assertEqual(OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET), array());
OC_User::setUserId($this->user3);
$this->assertEqual(OCP\Share::getItemsShared('test'), array());