summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-21 10:38:34 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-21 10:38:34 +0100
commit510488ad3e24110c435423860e9afbc58020ed66 (patch)
tree2a943f7090933f1d496e5bacafda82971d87e686 /apps/files_sharing/tests
parent312891c6032176346e6e624949fbceca6a85a7a7 (diff)
parent11b3aa2dbe792c306dab6f17b9633393ae739090 (diff)
downloadnextcloud-server-510488ad3e24110c435423860e9afbc58020ed66.tar.gz
nextcloud-server-510488ad3e24110c435423860e9afbc58020ed66.zip
Merge pull request #12942 from owncloud/favs-missingsharedsubdirs
Fix issues with searchByTag in shared storage
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/cache.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index b60bba73db8..f3f8f924b44 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -22,7 +22,6 @@ use OCA\Files_sharing\Tests\TestCase;
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
class Test_Files_Sharing_Cache extends TestCase {
/**
@@ -238,6 +237,62 @@ class Test_Files_Sharing_Cache extends TestCase {
$tagManager->delete(array('tag1', 'tag2'));
}
+ /**
+ * Test searching by tag for multiple sections of the tree
+ */
+ function testSearchByTagTree() {
+ $userId = \OC::$server->getUserSession()->getUser()->getUId();
+ $this->sharedStorage->mkdir('subdir/emptydir');
+ $this->sharedStorage->mkdir('subdir/emptydir2');
+ $this->ownerStorage->getScanner()->scan('');
+ $allIds = array(
+ $this->sharedCache->get('')['fileid'],
+ $this->sharedCache->get('bar.txt')['fileid'],
+ $this->sharedCache->get('subdir/another too.txt')['fileid'],
+ $this->sharedCache->get('subdir/not a text file.xml')['fileid'],
+ $this->sharedCache->get('subdir/another.txt')['fileid'],
+ $this->sharedCache->get('subdir/emptydir')['fileid'],
+ $this->sharedCache->get('subdir/emptydir2')['fileid'],
+ );
+ $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
+ foreach ($allIds as $id) {
+ $tagManager->tagAs($id, 'tag1');
+ }
+ $results = $this->sharedStorage->getCache()->searchByTag('tag1', $userId);
+ $check = array(
+ array(
+ 'name' => 'shareddir',
+ 'path' => ''
+ ),
+ array(
+ 'name' => 'bar.txt',
+ 'path' => 'bar.txt'
+ ),
+ array(
+ 'name' => 'another.txt',
+ 'path' => 'subdir/another.txt'
+ ),
+ array(
+ 'name' => 'another too.txt',
+ 'path' => 'subdir/another too.txt'
+ ),
+ array(
+ 'name' => 'emptydir',
+ 'path' => 'subdir/emptydir'
+ ),
+ array(
+ 'name' => 'emptydir2',
+ 'path' => 'subdir/emptydir2'
+ ),
+ array(
+ 'name' => 'not a text file.xml',
+ 'path' => 'subdir/not a text file.xml'
+ ),
+ );
+ $this->verifyFiles($check, $results);
+ $tagManager->delete(array('tag1'));
+ }
+
function testGetFolderContentsInRoot() {
$results = $this->user2View->getDirectoryContent('/');