Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-11-10 17:44:18 +0300
committerVincent Petry <pvince81@owncloud.com>2016-11-23 14:27:36 +0300
commiteca5ff31fb10c2469a8c4cebf62f9993d2fed621 (patch)
tree3b5c0d493f949755713bb52c8d36d2fdf33ad8fb /tests
parent6c0d4bc2acbfb34e8ca233b4ff1938e4d56dd432 (diff)
Skip local shares in bkg scan and occ files:scan (#26590)
Local shares should only be scanned when doing it for the owner to avoid repeatedly rescanning the same shared storage over and over again for every recipient.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/utils/scanner.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php
index 1220c57e962..5b234801e33 100644
--- a/tests/lib/files/utils/scanner.php
+++ b/tests/lib/files/utils/scanner.php
@@ -187,4 +187,26 @@ class Scanner extends \Test\TestCase {
$this->assertNotEquals($oldRoot->getEtag(), $newRoot->getEtag());
}
+
+ public function testSkipLocalShares() {
+ $sharedStorage = $this->getMockBuilder('OC\Files\Storage\Shared')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $sharedMount = new MountPoint($sharedStorage, '/share');
+ Filesystem::getMountManager()->addMount($sharedMount);
+
+ $sharedStorage->expects($this->any())
+ ->method('instanceOfStorage')
+ ->will($this->returnValueMap([
+ ['OCA\Files_Sharing\ISharedStorage', true],
+ ]));
+ $sharedStorage->expects($this->never())
+ ->method('getScanner');
+
+ $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger());
+ $scanner->addMount($sharedMount);
+ $scanner->scan('');
+
+ $scanner->backgroundScan('');
+ }
}