summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-09-30 12:38:36 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-09-30 12:38:36 +0200
commit03db954e1a21951cbf451f32fd6234b7d27861f8 (patch)
tree561c6d3ea002d8fbead3a98e6da1afc409c0de29 /apps/files_sharing
parent9a2e82c3c54c0fa3661e8e5cb54acc4e3052b3e1 (diff)
downloadnextcloud-server-03db954e1a21951cbf451f32fd6234b7d27861f8.tar.gz
nextcloud-server-03db954e1a21951cbf451f32fd6234b7d27861f8.zip
add getShareFromFolder() test
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/tests/api.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index 271484f8d44..d91422bab24 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -251,6 +251,43 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
/**
* @medium
*/
+ function testGetShareFromFolder() {
+
+ $fileInfo1 = $this->view->getFileInfo($this->filename);
+ $fileInfo2 = $this->view->getFileInfo($this->folder.'/'.$this->filename);
+
+ $result = \OCP\Share::shareItem('file', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+
+ // share was successful?
+ $this->assertTrue($result);
+
+ $result = \OCP\Share::shareItem('file', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK,
+ null, 1);
+
+ // share was successful?
+ $this->assertTrue(is_string($result));
+
+ $_GET['file'] = $this->folder;
+ $_GET['subfiles'] = 'yes';
+
+ $result = Share\Api::getAllShares(array());
+
+ $this->assertTrue($result->succeeded());
+
+ // test should return one share within $this->folder
+ $this->assertTrue(count($result->getData()) === 1);
+
+ \OCP\Share::unshare('file', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+
+ \OCP\Share::unshare('file', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK, null);
+
+ }
+
+ /**
+ * @medium
+ */
function testGetShareFromUnknownId() {
$params = array('id' => 0);