From e198dc1b200f3ade93498e0ea7b468c87d46748a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 4 May 2021 19:06:02 +0200 Subject: rework search api to allow searching on multiple caches at once Signed-off-by: Robin Appelman --- tests/lib/Files/Cache/CacheTest.php | 7 +++++-- tests/lib/Files/Cache/QuerySearchHelperTest.php | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'tests') 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']) -- cgit v1.2.3