diff options
Diffstat (limited to 'tests/lib/Files/Cache/ScannerTest.php')
-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']); |