]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix tests 30058/head
authorRobin Appelman <robin@icewind.nl>
Wed, 17 Nov 2021 15:44:11 +0000 (16:44 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 2 Dec 2021 17:47:06 +0000 (17:47 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files/lib/BackgroundJob/ScanFiles.php
apps/files/tests/BackgroundJob/ScanFilesTest.php
apps/workflowengine/lib/Check/FileSystemTags.php
tests/lib/Files/Utils/ScannerTest.php

index 250338e12629bb41d0f0c2c6201f67fc589da9eb..84846b9b55d8cefaaf8536c37a24ee1f7029ac66 100644 (file)
@@ -30,7 +30,6 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
 use OCP\IDBConnection;
 use OCP\ILogger;
-use OCP\IUserManager;
 
 /**
  * Class ScanFiles is a background job used to run the file scanner over the user
@@ -57,10 +56,10 @@ class ScanFiles extends \OC\BackgroundJob\TimedJob {
         * @param IDBConnection $connection
         */
        public function __construct(
-               IConfig          $config,
+               IConfig $config,
                IEventDispatcher $dispatcher,
-               ILogger          $logger,
-               IDBConnection    $connection
+               ILogger $logger,
+               IDBConnection $connection
        ) {
                // Run once per 10 minutes
                $this->setInterval(60 * 10);
index f1fb505fe53d983e32d170e32a1b9bc2f7dbf3dd..04eeff4a30bbcc19ff24de199971fe688eefced4 100644 (file)
@@ -30,7 +30,6 @@ use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
 use OCP\ILogger;
 use OCP\IUser;
-use OCP\IUserManager;
 use Test\TestCase;
 use Test\Traits\MountProviderTrait;
 use Test\Traits\UserTrait;
@@ -54,7 +53,6 @@ class ScanFilesTest extends TestCase {
                parent::setUp();
 
                $config = $this->createMock(IConfig::class);
-               $userManager = $this->createMock(IUserManager::class);
                $dispatcher = $this->createMock(IEventDispatcher::class);
                $logger = $this->createMock(ILogger::class);
                $connection = \OC::$server->getDatabaseConnection();
@@ -63,7 +61,6 @@ class ScanFilesTest extends TestCase {
                $this->scanFiles = $this->getMockBuilder('\OCA\Files\BackgroundJob\ScanFiles')
                        ->setConstructorArgs([
                                $config,
-                               $userManager,
                                $dispatcher,
                                $logger,
                                $connection,
index a879a8e1703aaa7638e44d4044d2c9584192270d..c5f32bbb4e7e7d98c37705806cb9b257176eeca0 100644 (file)
@@ -135,8 +135,8 @@ class FileSystemTags implements ICheck, IFileCheck {
                // TODO: Fix caching inside group folders
                // Do not cache file ids inside group folders because multiple file ids might be mapped to
                // the same combination of cache id + path.
-               $shouldCacheFileIds = !$this->storage
-                       ->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
+               /** @psalm-suppress InvalidArgument */
+               $shouldCacheFileIds = !$this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
                $cacheId = $cache->getNumericStorageId();
                if ($shouldCacheFileIds && isset($this->fileIds[$cacheId][$path])) {
                        return $this->fileIds[$cacheId][$path];
index abd72416ffd7d6330ad124a4826ce6ab1623e61c..414d38bae06b1102ec47b153606982a467ad659f 100644 (file)
@@ -11,7 +11,6 @@ namespace Test\Files\Utils;
 use OC\Files\Filesystem;
 use OC\Files\Mount\MountPoint;
 use OC\Files\Storage\Temporary;
-use OCA\Files_Sharing\SharedStorage;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Config\IMountProvider;
 use OCP\Files\Storage\IStorageFactory;
@@ -192,25 +191,6 @@ class ScannerTest extends \Test\TestCase {
                $this->assertNotEquals($oldRoot->getEtag(), $newRoot->getEtag());
        }
 
-       public function testSkipLocalShares() {
-               $sharedStorage = $this->createMock(SharedStorage::class);
-               $sharedMount = new MountPoint($sharedStorage, '/share');
-               Filesystem::getMountManager()->addMount($sharedMount);
-
-               $sharedStorage->method('instanceOfStorage')
-                       ->willReturnCallback(function (string $c) {
-                               return $c === SharedStorage::class;
-                       });
-               $sharedStorage->expects($this->never())
-                       ->method('getScanner');
-
-               $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
-               $scanner->addMount($sharedMount);
-               $scanner->scan('');
-
-               $scanner->backgroundScan('');
-       }
-
        public function testShallow() {
                $storage = new Temporary([]);
                $mount = new MountPoint($storage, '');