diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2020-11-09 11:58:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 11:58:36 +0100 |
commit | 72545ffd07a07f142c9c18b3e4afc9ae1b5c8da2 (patch) | |
tree | 3cf50421355a0c04d1280888e2436b705eba86bf /tests | |
parent | f02bab1425b9db105bfd4a8e37e56ac589ab971e (diff) | |
parent | c07720de77282408ddf00311bb13c27d7a898d84 (diff) | |
download | nextcloud-server-72545ffd07a07f142c9c18b3e4afc9ae1b5c8da2.tar.gz nextcloud-server-72545ffd07a07f142c9c18b3e4afc9ae1b5c8da2.zip |
Merge pull request #23937 from nextcloud/bugfix/noid/files-ocdb
Use query builder instead of OC_DB in OC\Files\*
Diffstat (limited to 'tests')
-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']); |