aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Cache/ScannerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Cache/ScannerTest.php')
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index d78b7100d43..123c13893f7 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -14,6 +15,8 @@ use OC\Files\Cache\Scanner;
use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OCP\Files\Cache\IScanner;
+use OCP\IDBConnection;
+use OCP\Server;
use Test\TestCase;
/**
@@ -67,7 +70,7 @@ class ScannerTest extends TestCase {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo🙈.txt', $data);
- if (OC::$server->getDatabaseConnection()->supports4ByteText()) {
+ if (Server::get(IDBConnection::class)->supports4ByteText()) {
$this->assertNotNull($this->scanner->scanFile('foo🙈.txt'));
$this->assertTrue($this->cache->inCache('foo🙈.txt'), true);
@@ -337,7 +340,7 @@ class ScannerTest extends TestCase {
$oldFolderId = $this->cache->getId('folder');
// delete the folder without removing the children
- $query = OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $query = Server::get(IDBConnection::class)->getQueryBuilder();
$query->delete('filecache')
->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId)));
$query->execute();
@@ -363,7 +366,7 @@ class ScannerTest extends TestCase {
$oldFolderId = $this->cache->getId('folder');
// delete the folder without removing the children
- $query = OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $query = Server::get(IDBConnection::class)->getQueryBuilder();
$query->delete('filecache')
->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId)));
$query->execute();
@@ -383,18 +386,18 @@ class ScannerTest extends TestCase {
}
/**
- * @dataProvider dataTestIsPartialFile
*
* @param string $path
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsPartialFile')]
public function testIsPartialFile($path, $expected): void {
$this->assertSame($expected,
$this->scanner->isPartialFile($path)
);
}
- public function dataTestIsPartialFile() {
+ public static function dataTestIsPartialFile(): array {
return [
['foo.txt.part', true],
['/sub/folder/foo.txt.part', true],