Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-10-16 10:27:02 +0300
committerRoeland Jago Douma <rullzer@owncloud.com>2015-10-16 21:43:17 +0300
commit9e86d71cc533e84084a4dd5e440af0f5aa516108 (patch)
tree5f770ba8f7a36d098b60d6ca4a3f7997eefb5e7c /tests
parent9e6a4dce43e298cbbfde963242d4f6780784a2ae (diff)
When sharing with the owner show the path
The error message should contain the path that is being shared not the numeric id.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share/share.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index fc1357fe6e7..dc716e898e7 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -1735,6 +1735,30 @@ class Test_Share extends \Test\TestCase {
);
$this->assertCount(4, $res);
}
+
+ public function testShareWithOwnerError() {
+ OC_User::setUserId($this->user1);
+ $view = new \OC\Files\View('/' . $this->user1 . '/');
+ $view->mkdir('files/folder1');
+
+ $fileInfo = $view->getFileInfo('files/folder1');
+ $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo);
+ $fileId = $fileInfo->getId();
+
+ $this->assertTrue(
+ OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL),
+ 'Failed asserting that user 1 successfully shared "test" with user 2.'
+ );
+
+ OC_User::setUserId($this->user1);
+
+ try {
+ OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL);
+ $this->fail();
+ } catch (\Exception $e) {
+ $this->assertEquals('Sharing /folder1 failed, because the user ' . $this->user1 . ' is the item owner', $e->getMessage());
+ }
+ }
}
class DummyShareClass extends \OC\Share\Share {