diff options
author | Joas Schilling <coding@schilljs.com> | 2017-07-22 12:21:00 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-08-02 09:48:16 +0200 |
commit | 20f8d1094ab9958dc50104a79a2ad0f0a9e0ce1a (patch) | |
tree | 6d4a58f43aa068cc593f30cbd98ce4737016423a /tests/lib/Files | |
parent | 106df7bc330a2c2e6d974e33be2bed26e22b538e (diff) | |
download | nextcloud-server-20f8d1094ab9958dc50104a79a2ad0f0a9e0ce1a.tar.gz nextcloud-server-20f8d1094ab9958dc50104a79a2ad0f0a9e0ce1a.zip |
Can not insert auto increment on oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/Cache/QuerySearchHelperTest.php | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/tests/lib/Files/Cache/QuerySearchHelperTest.php b/tests/lib/Files/Cache/QuerySearchHelperTest.php index f458ef039e1..850cee066a1 100644 --- a/tests/lib/Files/Cache/QuerySearchHelperTest.php +++ b/tests/lib/Files/Cache/QuerySearchHelperTest.php @@ -129,6 +129,8 @@ class QuerySearchHelperTest extends TestCase { $builder->insert('filecache') ->values($values) ->execute(); + + return $builder->getLastInsertId(); } private function search(ISearchOperator $operator) { @@ -139,34 +141,34 @@ class QuerySearchHelperTest extends TestCase { public function comparisonProvider() { return [ - [new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125), [1002]], - [new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [1001]], + [new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125), [1]], + [new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [0]], [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 125), []], - [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50), [1001, 1002]], - [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foobar'), [1001]], - [new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%'), [1001, 1002]], - [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpg'), [1001]], - [new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'image/%'), [1001, 1002]], + [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50), [0, 1]], + [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foobar'), [0]], + [new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%'), [0, 1]], + [new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpg'), [0]], + [new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'image/%'), [0, 1]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50), - new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [1001] - ]), [1001]], + new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [0] + ]), [0]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 100), new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150), - ]), [1001, 1002]], + ]), [0, 1]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150), - ]), [1001]], + ]), [0]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [ new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125), - ]), [1001]], + ]), [0]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [ new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), - ]), [1002]], + ]), [1]], [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%bar'), - ]), [1002]], + ]), [1]], ]; } @@ -178,22 +180,25 @@ class QuerySearchHelperTest extends TestCase { * @param array $fileIds */ public function testComparison(ISearchOperator $operator, array $fileIds) { - $this->addCacheEntry([ + $fileId = []; + $fileId[] = $this->addCacheEntry([ 'path' => 'foobar', - 'fileid' => 1001, 'mtime' => 100, 'size' => 50, 'mimetype' => 'image/jpg' ]); - $this->addCacheEntry([ + $fileId[] = $this->addCacheEntry([ 'path' => 'fooasd', - 'fileid' => 1002, 'mtime' => 150, 'size' => 50, 'mimetype' => 'image/png' ]); + $fileIds = array_map(function($i) use ($fileId) { + return $fileId[$i]; + }, $fileIds); + $results = $this->search($operator); sort($fileIds); |