aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Share20/ManagerTest.php9
-rw-r--r--tests/lib/TestCase.php2
-rw-r--r--tests/lib/Traits/MountProviderTrait.php6
3 files changed, 16 insertions, 1 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 65a5ff8946d..58f96c418b8 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -613,6 +613,7 @@ class ManagerTest extends \Test\TestCase {
$limitedPermssions = $this->createMock(File::class);
$limitedPermssions->method('isShareable')->willReturn(true);
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+ $limitedPermssions->method('getId')->willReturn(108);
$limitedPermssions->method('getPath')->willReturn('path');
$limitedPermssions->method('getOwner')
->willReturn($owner);
@@ -634,6 +635,7 @@ class ManagerTest extends \Test\TestCase {
$nonMoveableMountPermssions = $this->createMock(Folder::class);
$nonMoveableMountPermssions->method('isShareable')->willReturn(true);
$nonMoveableMountPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+ $nonMoveableMountPermssions->method('getId')->willReturn(108);
$nonMoveableMountPermssions->method('getPath')->willReturn('path');
$nonMoveableMountPermssions->method('getOwner')
->willReturn($owner);
@@ -655,6 +657,7 @@ class ManagerTest extends \Test\TestCase {
$allPermssions = $this->createMock(Folder::class);
$allPermssions->method('isShareable')->willReturn(true);
$allPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL);
+ $allPermssions->method('getId')->willReturn(108);
$allPermssions->method('getOwner')
->willReturn($owner);
$allPermssions->method('getStorage')
@@ -675,6 +678,7 @@ class ManagerTest extends \Test\TestCase {
$remoteFile = $this->createMock(Folder::class);
$remoteFile->method('isShareable')->willReturn(true);
$remoteFile->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ ^ \OCP\Constants::PERMISSION_UPDATE);
+ $remoteFile->method('getId')->willReturn(108);
$remoteFile->method('getOwner')
->willReturn($owner);
$remoteFile->method('getStorage')
@@ -709,6 +713,11 @@ class ManagerTest extends \Test\TestCase {
$userFolder->expects($this->any())
->method('getId')
->willReturn(42);
+ // Id 108 is used in the data to refer to the node of the share.
+ $userFolder->expects($this->any())
+ ->method('getById')
+ ->with(108)
+ ->willReturn([$share->getNode()]);
$userFolder->expects($this->any())
->method('getRelativePath')
->willReturnArgument(0);
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index b28be47875a..88c5b468543 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -441,7 +441,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
}
}
- private function IsDatabaseAccessAllowed() {
+ protected function IsDatabaseAccessAllowed() {
// on travis-ci.org we allow database access in any case - otherwise
// this will break all apps right away
if (true == getenv('TRAVIS')) {
diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php
index 0437157e84f..379d33ea71c 100644
--- a/tests/lib/Traits/MountProviderTrait.php
+++ b/tests/lib/Traits/MountProviderTrait.php
@@ -33,6 +33,12 @@ trait MountProviderTrait {
$this->mounts[$userId] = [];
}
$this->mounts[$userId][] = ['storage' => $storage, 'mountPoint' => $mountPoint, 'arguments' => $arguments];
+
+ if ($this->IsDatabaseAccessAllowed()) {
+ $mount = new MountPoint($storage, $mountPoint, $arguments, $this->storageFactory);
+ $storage = $mount->getStorage();
+ $storage->getScanner()->scan('');
+ }
}
protected function registerStorageWrapper($name, $wrapper) {