summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/cache.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-12-04 14:01:15 +0100
committerVincent Petry <pvince81@owncloud.com>2014-12-11 17:38:50 +0100
commit25dde7e93bc648ec8cd14b8f2711d50f77d8d1bf (patch)
treef45b35dd647870b6c3aeded3e8e11faa41effcba /apps/files_sharing/tests/cache.php
parent745d8706b973ff0494af54f183acc0da361f0e83 (diff)
downloadnextcloud-server-25dde7e93bc648ec8cd14b8f2711d50f77d8d1bf.tar.gz
nextcloud-server-25dde7e93bc648ec8cd14b8f2711d50f77d8d1bf.zip
Added searchByTags to view, storage and cache
Diffstat (limited to 'apps/files_sharing/tests/cache.php')
-rw-r--r--apps/files_sharing/tests/cache.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index aec1983bad3..c40a014d557 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -204,6 +204,39 @@ class Test_Files_Sharing_Cache extends TestCase {
$this->verifyFiles($check, $results);
}
+ /**
+ * Test searching by tag
+ */
+ function testSearchByTag() {
+ $id1 = $this->sharedCache->get('bar.txt')['fileid'];
+ $id2 = $this->sharedCache->get('subdir/another too.txt')['fileid'];
+ $id3 = $this->sharedCache->get('subdir/not a text file.xml')['fileid'];
+ $id4 = $this->sharedCache->get('subdir/another.txt')['fileid'];
+ $tagManager = \OC::$server->getTagManager()->load('files');
+ $tagManager->tagAs($id1, 'tag1');
+ $tagManager->tagAs($id1, 'tag2');
+ $tagManager->tagAs($id2, 'tag1');
+ $tagManager->tagAs($id3, 'tag1');
+ $tagManager->tagAs($id4, 'tag2');
+ $results = $this->sharedStorage->getCache()->searchByTag('tag1');
+ $check = array(
+ array(
+ 'name' => 'bar.txt',
+ 'path' => 'bar.txt'
+ ),
+ array(
+ 'name' => 'another too.txt',
+ 'path' => 'subdir/another too.txt'
+ ),
+ array(
+ 'name' => 'not a text file.xml',
+ 'path' => 'subdir/not a text file.xml'
+ ),
+ );
+ $this->verifyFiles($check, $results);
+ $tagManager->delete(array('tag1', 'tag2'));
+ }
+
function testGetFolderContentsInRoot() {
$results = $this->user2View->getDirectoryContent('/');