aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/PersonalMountTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/tests/PersonalMountTest.php')
-rw-r--r--apps/files_external/tests/PersonalMountTest.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php
new file mode 100644
index 00000000000..618048c3335
--- /dev/null
+++ b/apps/files_external/tests/PersonalMountTest.php
@@ -0,0 +1,38 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace OCA\Files_External\Tests;
+
+use OC\Files\Mount\Manager;
+use OC\Files\SetupManagerFactory;
+use OC\Files\Storage\Storage;
+use OCA\Files_External\Lib\PersonalMount;
+use OCA\Files_External\Lib\StorageConfig;
+use OCA\Files_External\Service\UserStoragesService;
+use Test\TestCase;
+
+class PersonalMountTest extends TestCase {
+ public function testFindByStorageId(): void {
+ $storageConfig = $this->createMock(StorageConfig::class);
+ /** @var UserStoragesService $storageService */
+ $storageService = $this->createMock(UserStoragesService::class);
+
+ $storage = $this->createMock(Storage::class);
+
+ $storage->expects($this->any())
+ ->method('getId')
+ ->willReturn('dummy');
+
+ $mount = new PersonalMount($storageService, $storageConfig, 10, $storage, '/foo');
+
+ $mountManager = new Manager($this->createMock(SetupManagerFactory::class));
+ $mountManager->addMount($mount);
+
+ $this->assertEquals([$mount], $mountManager->findByStorageId('dummy'));
+ }
+}