summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-07-18 15:06:55 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2019-07-26 12:29:19 +0200
commit0487144b2679f83f9a6b59b55561af062f692836 (patch)
treee2bd28fe000bb4fba8aed4f657ce16dbc2c40621 /tests/lib
parentb2341cdfd02b3e8ad90f8ae41320f708c3d54bb6 (diff)
downloadnextcloud-server-0487144b2679f83f9a6b59b55561af062f692836.tar.gz
nextcloud-server-0487144b2679f83f9a6b59b55561af062f692836.zip
Remove deprecated searchByTag
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Files/Cache/CacheTest.php70
-rw-r--r--tests/lib/Files/Node/FolderTest.php51
-rw-r--r--tests/lib/Lockdown/Filesystem/NullCacheTest.php4
3 files changed, 0 insertions, 125 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index f94b4f57078..eaea1692fe2 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -328,76 +328,6 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(2, count($this->cache->searchByMime('foo/file')));
}
- function testSearchByTag() {
- $userId = $this->getUniqueId('user');
- \OC::$server->getUserManager()->createUser($userId, $userId);
- $this->loginAsUser($userId);
- $user = new \OC\User\User($userId, null, \OC::$server->getEventDispatcher());
-
- $file1 = 'folder';
- $file2 = 'folder/foobar';
- $file3 = 'folder/foo';
- $file4 = 'folder/foo2';
- $file5 = 'folder/foo3';
- $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder');
- $fileData = array();
- $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
- $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file');
- $fileData['foo2'] = array('size' => 25, 'mtime' => 28, 'mimetype' => 'foo/file');
- $fileData['foo3'] = array('size' => 88, 'mtime' => 34, 'mimetype' => 'foo/file');
-
- $id1 = $this->cache->put($file1, $data1);
- $id2 = $this->cache->put($file2, $fileData['foobar']);
- $id3 = $this->cache->put($file3, $fileData['foo']);
- $id4 = $this->cache->put($file4, $fileData['foo2']);
- $id5 = $this->cache->put($file5, $fileData['foo3']);
-
- $tagManager = \OC::$server->getTagManager()->load('files', [], false, $userId);
- $this->assertTrue($tagManager->tagAs($id1, 'tag1'));
- $this->assertTrue($tagManager->tagAs($id1, 'tag2'));
- $this->assertTrue($tagManager->tagAs($id2, 'tag2'));
- $this->assertTrue($tagManager->tagAs($id3, 'tag1'));
- $this->assertTrue($tagManager->tagAs($id4, 'tag2'));
-
- // use tag name
- $results = $this->cache->searchByTag('tag1', $userId);
-
- $this->assertEquals(2, count($results));
-
- usort($results, function ($value1, $value2) {
- return $value1['name'] >= $value2['name'];
- });
-
- $this->assertEquals('folder', $results[0]['name']);
- $this->assertEquals('foo', $results[1]['name']);
-
- // use tag id
- $tags = $tagManager->getTagsForUser($userId);
- $this->assertNotEmpty($tags);
- $tags = array_filter($tags, function ($tag) {
- return $tag->getName() === 'tag2';
- });
- $results = $this->cache->searchByTag(current($tags)->getId(), $userId);
- $this->assertEquals(3, count($results));
-
- usort($results, function ($value1, $value2) {
- return $value1['name'] >= $value2['name'];
- });
-
- $this->assertEquals('folder', $results[0]['name']);
- $this->assertEquals('foo2', $results[1]['name']);
- $this->assertEquals('foobar', $results[2]['name']);
-
- $tagManager->delete('tag1');
- $tagManager->delete('tag2');
-
- $this->logout();
- $user = \OC::$server->getUserManager()->get($userId);
- if ($user !== null) {
- $user->delete();
- }
- }
-
function testSearchQueryByTag() {
$userId = static::getUniqueID('user');
\OC::$server->getUserManager()->createUser($userId, $userId);
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index e1ee96c37ec..daac67cae23 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -432,57 +432,6 @@ class FolderTest extends NodeTest {
$this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
}
- public function testSearchByTag() {
- $manager = $this->createMock(Manager::class);
- /**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
- */
- $view = $this->createMock(View::class);
- $root = $this->getMockBuilder(Root::class)
- ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
- ->getMock();
- $root->expects($this->any())
- ->method('getUser')
- ->will($this->returnValue($this->user));
- $storage = $this->createMock(Storage::class);
- $storage->method('getId')->willReturn('');
- $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
-
- $mount = $this->createMock(IMountPoint::class);
- $mount->expects($this->once())
- ->method('getStorage')
- ->will($this->returnValue($storage));
- $mount->expects($this->once())
- ->method('getInternalPath')
- ->will($this->returnValue('foo'));
-
- $storage->expects($this->once())
- ->method('getCache')
- ->will($this->returnValue($cache));
-
- $cache->expects($this->once())
- ->method('searchByTag')
- ->with('tag1', 'user1')
- ->will($this->returnValue(array(
- array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
-
- $root->expects($this->once())
- ->method('getMountsIn')
- ->with('/bar/foo')
- ->will($this->returnValue(array()));
-
- $root->expects($this->once())
- ->method('getMount')
- ->with('/bar/foo')
- ->will($this->returnValue($mount));
-
- $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
- $result = $node->searchByTag('tag1', 'user1');
- $this->assertEquals(1, count($result));
- $this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
- }
-
public function testSearchSubStorages() {
$manager = $this->createMock(Manager::class);
/**
diff --git a/tests/lib/Lockdown/Filesystem/NullCacheTest.php b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
index 3a4e3f3a402..7773241fca1 100644
--- a/tests/lib/Lockdown/Filesystem/NullCacheTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
@@ -139,10 +139,6 @@ class NulLCacheTest extends \Test\TestCase {
$this->assertSame([], $this->cache->searchByMime('foo'));
}
- public function testSearchByTag() {
- $this->assertSame([], $this->cache->searchByTag('foo', 'user'));
- }
-
public function testGetIncomplete() {
$this->assertSame([], $this->cache->getIncomplete());
}