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
* @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);
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
-use OCP\IUserManager;
use Test\TestCase;
use Test\Traits\MountProviderTrait;
use Test\Traits\UserTrait;
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();
$this->scanFiles = $this->getMockBuilder('\OCA\Files\BackgroundJob\ScanFiles')
->setConstructorArgs([
$config,
- $userManager,
$dispatcher,
$logger,
$connection,
// 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];
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;
$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, '');