diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-06 12:06:24 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-09 09:05:15 +0100 |
commit | c07720de77282408ddf00311bb13c27d7a898d84 (patch) | |
tree | 1fd19efca06d588c6033fc9c31076b770ece6e92 /tests/lib | |
parent | f5be2c722a6c32cb9bc562cf79b97279d60c6290 (diff) | |
download | nextcloud-server-c07720de77282408ddf00311bb13c27d7a898d84.tar.gz nextcloud-server-c07720de77282408ddf00311bb13c27d7a898d84.zip |
Use query builder instead of OC_DB in OC\Files\*
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Files/Cache/ScannerTest.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index f9c05d52ee5..29e619cd09b 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -206,19 +206,19 @@ class ScannerTest extends \Test\TestCase { public function testBackgroundScanNestedIncompleteFolders() { $this->storage->mkdir('folder'); $this->scanner->backgroundScan(); - + $this->storage->mkdir('folder/subfolder1'); $this->storage->mkdir('folder/subfolder2'); - + $this->storage->mkdir('folder/subfolder1/subfolder3'); $this->cache->put('folder', ['size' => -1]); $this->cache->put('folder/subfolder1', ['size' => -1]); - + // do a scan to get the folders into the cache. $this->scanner->backgroundScan(); $this->assertTrue($this->cache->inCache('folder/subfolder1/subfolder3')); - + $this->storage->file_put_contents('folder/subfolder1/bar1.txt', 'foobar'); $this->storage->file_put_contents('folder/subfolder1/subfolder3/bar3.txt', 'foobar'); $this->storage->file_put_contents('folder/subfolder2/bar2.txt', 'foobar'); @@ -227,7 +227,7 @@ class ScannerTest extends \Test\TestCase { $this->cache->put('folder/subfolder1', ['size' => -1]); $this->cache->put('folder/subfolder2', ['size' => -1]); $this->cache->put('folder/subfolder1/subfolder3', ['size' => -1]); - + $this->scanner->backgroundScan(); $this->assertTrue($this->cache->inCache('folder/subfolder1/bar1.txt')); @@ -343,9 +343,11 @@ class ScannerTest extends \Test\TestCase { $this->assertTrue($this->cache->inCache('folder/bar.txt')); $oldFolderId = $this->cache->getId('folder'); - // delete the folder without removing the childs - $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, [$oldFolderId]); + // delete the folder without removing the children + $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $query->delete('filecache') + ->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId))); + $query->execute(); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); @@ -367,9 +369,11 @@ class ScannerTest extends \Test\TestCase { $this->assertTrue($this->cache->inCache('folder/bar.txt')); $oldFolderId = $this->cache->getId('folder'); - // delete the folder without removing the childs - $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, [$oldFolderId]); + // delete the folder without removing the children + $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $query->delete('filecache') + ->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId))); + $query->execute(); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); |