diff options
author | Robin Appelman <robin@icewind.nl> | 2021-05-04 19:06:02 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-06-14 16:11:22 +0200 |
commit | e198dc1b200f3ade93498e0ea7b468c87d46748a (patch) | |
tree | 235c30d6035bec46bef5ee2f2b134333dfb65409 /tests | |
parent | dfbac05f7ba00c78ac15df61a425317a890b08d1 (diff) | |
download | nextcloud-server-e198dc1b200f3ade93498e0ea7b468c87d46748a.tar.gz nextcloud-server-e198dc1b200f3ade93498e0ea7b468c87d46748a.zip |
rework search api to allow searching on multiple caches at once
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Cache/CacheTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Files/Cache/QuerySearchHelperTest.php | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index d74f9cc723c..744a779288d 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -363,7 +363,7 @@ class CacheTest extends \Test\TestCase { $this->assertEquals(3, count($results)); usort($results, function ($value1, $value2) { - return $value1['name'] >= $value2['name']; + return $value1['name'] <=> $value2['name']; }); $this->assertEquals('folder', $results[0]['name']); @@ -376,7 +376,10 @@ class CacheTest extends \Test\TestCase { static::logout(); $user = \OC::$server->getUserManager()->get($userId); if ($user !== null) { - $user->delete(); + try { + $user->delete(); + } catch (\Exception $e) { + } } } diff --git a/tests/lib/Files/Cache/QuerySearchHelperTest.php b/tests/lib/Files/Cache/QuerySearchHelperTest.php index 7ae0c2b38c2..46aa5a55493 100644 --- a/tests/lib/Files/Cache/QuerySearchHelperTest.php +++ b/tests/lib/Files/Cache/QuerySearchHelperTest.php @@ -25,11 +25,14 @@ use OC\DB\QueryBuilder\Literal; use OC\Files\Cache\QuerySearchHelper; use OC\Files\Search\SearchBinaryOperator; use OC\Files\Search\SearchComparison; +use OC\SystemConfig; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\IMimeTypeLoader; use OCP\Files\Search\ISearchBinaryOperator; use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchOperator; +use OCP\IDBConnection; +use OCP\ILogger; use Test\TestCase; /** @@ -75,7 +78,15 @@ class QuerySearchHelperTest extends TestCase { [6, 'image'] ]); - $this->querySearchHelper = new QuerySearchHelper($this->mimetypeLoader); + $systemConfig = $this->createMock(SystemConfig::class); + $logger = $this->createMock(ILogger::class); + + $this->querySearchHelper = new QuerySearchHelper( + $this->mimetypeLoader, + \OC::$server->get(IDBConnection::class), + $systemConfig, + $logger + ); $this->numericStorageId = 10000; $this->builder->select(['fileid']) |