aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Mount
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Mount')
-rw-r--r--tests/lib/Files/Mount/ManagerTest.php18
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php26
-rw-r--r--tests/lib/Files/Mount/MountTest.php14
-rw-r--r--tests/lib/Files/Mount/ObjectHomeMountProviderTest.php288
-rw-r--r--tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php4
-rw-r--r--tests/lib/Files/Mount/RootMountProviderTest.php57
6 files changed, 218 insertions, 189 deletions
diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php
index f8adb2bf1cf..e6cf3348664 100644
--- a/tests/lib/Files/Mount/ManagerTest.php
+++ b/tests/lib/Files/Mount/ManagerTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,11 +8,12 @@
namespace Test\Files\Mount;
+use OC\Files\Mount\MountPoint;
use OC\Files\SetupManagerFactory;
use OC\Files\Storage\Temporary;
class LongId extends Temporary {
- public function getId() {
+ public function getId(): string {
return 'long:' . str_repeat('foo', 50) . parent::getId();
}
}
@@ -27,34 +29,34 @@ class ManagerTest extends \Test\TestCase {
$this->manager = new \OC\Files\Mount\Manager($this->createMock(SetupManagerFactory::class));
}
- public function testFind() {
- $rootMount = new \OC\Files\Mount\MountPoint(new Temporary([]), '/');
+ public function testFind(): void {
+ $rootMount = new MountPoint(new Temporary([]), '/');
$this->manager->addMount($rootMount);
$this->assertEquals($rootMount, $this->manager->find('/'));
$this->assertEquals($rootMount, $this->manager->find('/foo/bar'));
$storage = new Temporary([]);
- $mount1 = new \OC\Files\Mount\MountPoint($storage, '/foo');
+ $mount1 = new MountPoint($storage, '/foo');
$this->manager->addMount($mount1);
$this->assertEquals($rootMount, $this->manager->find('/'));
$this->assertEquals($mount1, $this->manager->find('/foo/bar'));
$this->assertEquals(1, count($this->manager->findIn('/')));
- $mount2 = new \OC\Files\Mount\MountPoint(new Temporary([]), '/bar');
+ $mount2 = new MountPoint(new Temporary([]), '/bar');
$this->manager->addMount($mount2);
$this->assertEquals(2, count($this->manager->findIn('/')));
$id = $mount1->getStorageId();
$this->assertEquals([$mount1], $this->manager->findByStorageId($id));
- $mount3 = new \OC\Files\Mount\MountPoint($storage, '/foo/bar');
+ $mount3 = new MountPoint($storage, '/foo/bar');
$this->manager->addMount($mount3);
$this->assertEquals([$mount1, $mount3], $this->manager->findByStorageId($id));
}
- public function testLong() {
+ public function testLong(): void {
$storage = new LongId([]);
- $mount = new \OC\Files\Mount\MountPoint($storage, '/foo');
+ $mount = new MountPoint($storage, '/foo');
$this->manager->addMount($mount);
$id = $mount->getStorageId();
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index 189667df276..bcbcc96e3a3 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,15 +8,14 @@
namespace Test\Files\Mount;
+use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
-use OCP\Files\Storage;
-
-class DummyStorage {
-}
+use OC\Lockdown\Filesystem\NullStorage;
+use OCP\Files\Storage\IStorage;
class MountPointTest extends \Test\TestCase {
- public function testGetStorage() {
- $storage = $this->createMock(Storage::class);
+ public function testGetStorage(): void {
+ $storage = $this->createMock(IStorage::class);
$storage->expects($this->once())
->method('getId')
->willReturn(123);
@@ -25,9 +25,9 @@ class MountPointTest extends \Test\TestCase {
->method('wrap')
->willReturn($storage);
- $mountPoint = new \OC\Files\Mount\MountPoint(
+ $mountPoint = new MountPoint(
// just use this because a real class is needed
- '\Test\Files\Mount\DummyStorage',
+ NullStorage::class,
'/mountpoint',
null,
$loader
@@ -41,20 +41,20 @@ class MountPointTest extends \Test\TestCase {
$this->assertEquals('/another/', $mountPoint->getMountPoint());
}
- public function testInvalidStorage() {
+ public function testInvalidStorage(): void {
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
- ->will($this->throwException(new \Exception('Test storage init exception')));
+ ->willThrowException(new \Exception('Test storage init exception'));
$called = false;
- $wrapper = function ($mountPoint, $storage) use ($called) {
+ $wrapper = function ($mountPoint, $storage) use ($called): void {
$called = true;
};
- $mountPoint = new \OC\Files\Mount\MountPoint(
+ $mountPoint = new MountPoint(
// just use this because a real class is needed
- '\Test\Files\Mount\DummyStorage',
+ NullStorage::class,
'/mountpoint',
null,
$loader
diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php
index 0b4c6a214f3..05c8a7d58e7 100644
--- a/tests/lib/Files/Mount/MountTest.php
+++ b/tests/lib/Files/Mount/MountTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,24 +8,25 @@
namespace Test\Files\Mount;
+use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
use OC\Files\Storage\Wrapper\Wrapper;
class MountTest extends \Test\TestCase {
- public function testFromStorageObject() {
+ public function testFromStorageObject(): void {
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()
->getMock();
- $mount = new \OC\Files\Mount\MountPoint($storage, '/foo');
+ $mount = new MountPoint($storage, '/foo');
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
- public function testFromStorageClassname() {
- $mount = new \OC\Files\Mount\MountPoint('\OC\Files\Storage\Temporary', '/foo');
+ public function testFromStorageClassname(): void {
+ $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo');
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
- public function testWrapper() {
+ public function testWrapper(): void {
$test = $this;
$wrapper = function ($mountPoint, $storage) use (&$test) {
$test->assertEquals('/foo/', $mountPoint);
@@ -38,7 +40,7 @@ class MountTest extends \Test\TestCase {
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()
->getMock();
- $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', [], $loader);
+ $mount = new MountPoint($storage, '/foo', [], $loader);
$this->assertInstanceOf('\OC\Files\Storage\Wrapper\Wrapper', $mount->getStorage());
}
}
diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
index 9b6aaeccfeb..ae0a53f2cc0 100644
--- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,6 +8,9 @@
namespace Test\Files\Mount;
use OC\Files\Mount\ObjectHomeMountProvider;
+use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
+use OCP\App\IAppManager;
+use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\IUser;
@@ -31,53 +35,56 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->user = $this->createMock(IUser::class);
$this->loader = $this->createMock(IStorageFactory::class);
- $this->provider = new ObjectHomeMountProvider($this->config);
+ $objectStoreConfig = new PrimaryObjectStoreConfig($this->config, $this->createMock(IAppManager::class));
+ $this->provider = new ObjectHomeMountProvider($objectStoreConfig);
}
- public function testSingleBucket() {
- $this->config->expects($this->once())
- ->method('getSystemValue')
- ->with($this->equalTo('objectstore'), '')
- ->willReturn([
- 'class' => 'Test\Files\Mount\FakeObjectStore',
- ]);
+ public function testSingleBucket(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'objectstore') {
+ return [
+ 'class' => 'Test\Files\Mount\FakeObjectStore',
+ 'arguments' => [
+ 'foo' => 'bar'
+ ],
+ ];
+ } else {
+ return $default;
+ }
+ });
- $this->user->expects($this->never())->method($this->anything());
- $this->loader->expects($this->never())->method($this->anything());
-
- $config = $this->invokePrivate($this->provider, 'getSingleBucketObjectStoreConfig', [$this->user, $this->loader]);
+ $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
+ $arguments = $this->invokePrivate($mount, 'arguments');
- $this->assertArrayHasKey('class', $config);
- $this->assertEquals($config['class'], 'Test\Files\Mount\FakeObjectStore');
- $this->assertArrayHasKey('arguments', $config);
- $this->assertArrayHasKey('user', $config['arguments']);
- $this->assertSame($this->user, $config['arguments']['user']);
- $this->assertArrayHasKey('objectstore', $config['arguments']);
- $this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
+ $objectStore = $arguments['objectstore'];
+ $this->assertInstanceOf(FakeObjectStore::class, $objectStore);
+ $this->assertEquals(['foo' => 'bar', 'multibucket' => false], $objectStore->getArguments());
}
- public function testMultiBucket() {
- $this->config->expects($this->exactly(2))
- ->method('getSystemValue')
- ->with($this->equalTo('objectstore_multibucket'), '')
- ->willReturn([
- 'class' => 'Test\Files\Mount\FakeObjectStore',
- ]);
+ public function testMultiBucket(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'objectstore_multibucket') {
+ return [
+ 'class' => 'Test\Files\Mount\FakeObjectStore',
+ 'arguments' => [
+ 'foo' => 'bar'
+ ],
+ ];
+ } else {
+ return $default;
+ }
+ });
$this->user->method('getUID')
->willReturn('uid');
$this->loader->expects($this->never())->method($this->anything());
- $this->config->expects($this->once())
- ->method('getUserValue')
- ->with(
- $this->equalTo('uid'),
- $this->equalTo('homeobjectstore'),
- $this->equalTo('bucket'),
- $this->equalTo(null)
- )->willReturn(null);
+ $this->config->method('getUserValue')
+ ->willReturn(null);
- $this->config->expects($this->once())
+ $this->config
->method('setUserValue')
->with(
$this->equalTo('uid'),
@@ -87,42 +94,37 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->equalTo(null)
);
- $config = $this->invokePrivate($this->provider, 'getMultiBucketObjectStoreConfig', [$this->user, $this->loader]);
-
- $this->assertArrayHasKey('class', $config);
- $this->assertEquals($config['class'], 'Test\Files\Mount\FakeObjectStore');
- $this->assertArrayHasKey('arguments', $config);
- $this->assertArrayHasKey('user', $config['arguments']);
- $this->assertSame($this->user, $config['arguments']['user']);
- $this->assertArrayHasKey('objectstore', $config['arguments']);
- $this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
- $this->assertArrayHasKey('bucket', $config['arguments']);
- $this->assertEquals('49', $config['arguments']['bucket']);
- }
-
- public function testMultiBucketWithPrefix() {
- $this->config->expects($this->exactly(2))
- ->method('getSystemValue')
- ->with('objectstore_multibucket')
- ->willReturn([
- 'class' => 'Test\Files\Mount\FakeObjectStore',
- 'arguments' => [
- 'bucket' => 'myBucketPrefix',
- ],
- ]);
+ $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
+ $arguments = $this->invokePrivate($mount, 'arguments');
+
+ $objectStore = $arguments['objectstore'];
+ $this->assertInstanceOf(FakeObjectStore::class, $objectStore);
+ $this->assertEquals(['foo' => 'bar', 'bucket' => 49, 'multibucket' => true], $objectStore->getArguments());
+ }
+
+ public function testMultiBucketWithPrefix(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'objectstore_multibucket') {
+ return [
+ 'class' => 'Test\Files\Mount\FakeObjectStore',
+ 'arguments' => [
+ 'foo' => 'bar',
+ 'bucket' => 'myBucketPrefix',
+ ],
+ ];
+ } else {
+ return $default;
+ }
+ });
$this->user->method('getUID')
->willReturn('uid');
$this->loader->expects($this->never())->method($this->anything());
- $this->config->expects($this->once())
+ $this->config
->method('getUserValue')
- ->with(
- $this->equalTo('uid'),
- $this->equalTo('homeobjectstore'),
- $this->equalTo('bucket'),
- $this->equalTo(null)
- )->willReturn(null);
+ ->willReturn(null);
$this->config->expects($this->once())
->method('setUserValue')
@@ -134,66 +136,70 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->equalTo(null)
);
- $config = $this->invokePrivate($this->provider, 'getMultiBucketObjectStoreConfig', [$this->user, $this->loader]);
+ $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
+ $arguments = $this->invokePrivate($mount, 'arguments');
- $this->assertArrayHasKey('class', $config);
- $this->assertEquals($config['class'], 'Test\Files\Mount\FakeObjectStore');
- $this->assertArrayHasKey('arguments', $config);
- $this->assertArrayHasKey('user', $config['arguments']);
- $this->assertSame($this->user, $config['arguments']['user']);
- $this->assertArrayHasKey('objectstore', $config['arguments']);
- $this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
- $this->assertArrayHasKey('bucket', $config['arguments']);
- $this->assertEquals('myBucketPrefix49', $config['arguments']['bucket']);
+ $objectStore = $arguments['objectstore'];
+ $this->assertInstanceOf(FakeObjectStore::class, $objectStore);
+ $this->assertEquals(['foo' => 'bar', 'bucket' => 'myBucketPrefix49', 'multibucket' => true], $objectStore->getArguments());
}
- public function testMultiBucketBucketAlreadySet() {
- $this->config->expects($this->once())
- ->method('getSystemValue')
- ->with('objectstore_multibucket')
- ->willReturn([
- 'class' => 'Test\Files\Mount\FakeObjectStore',
- 'arguments' => [
- 'bucket' => 'myBucketPrefix',
- ],
- ]);
+ public function testMultiBucketBucketAlreadySet(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'objectstore_multibucket') {
+ return [
+ 'class' => 'Test\Files\Mount\FakeObjectStore',
+ 'arguments' => [
+ 'foo' => 'bar',
+ 'bucket' => 'myBucketPrefix',
+ ],
+ ];
+ } else {
+ return $default;
+ }
+ });
$this->user->method('getUID')
->willReturn('uid');
$this->loader->expects($this->never())->method($this->anything());
- $this->config->expects($this->once())
+ $this->config
->method('getUserValue')
- ->with(
- $this->equalTo('uid'),
- $this->equalTo('homeobjectstore'),
- $this->equalTo('bucket'),
- $this->equalTo(null)
- )->willReturn('awesomeBucket1');
+ ->willReturnCallback(function ($uid, $app, $key, $default) {
+ if ($uid === 'uid' && $app === 'homeobjectstore' && $key === 'bucket') {
+ return 'awesomeBucket1';
+ } else {
+ return $default;
+ }
+ });
$this->config->expects($this->never())
->method('setUserValue');
- $config = $this->invokePrivate($this->provider, 'getMultiBucketObjectStoreConfig', [$this->user, $this->loader]);
-
- $this->assertArrayHasKey('class', $config);
- $this->assertEquals($config['class'], 'Test\Files\Mount\FakeObjectStore');
- $this->assertArrayHasKey('arguments', $config);
- $this->assertArrayHasKey('user', $config['arguments']);
- $this->assertSame($this->user, $config['arguments']['user']);
- $this->assertArrayHasKey('objectstore', $config['arguments']);
- $this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
- $this->assertArrayHasKey('bucket', $config['arguments']);
- $this->assertEquals('awesomeBucket1', $config['arguments']['bucket']);
- }
-
- public function testMultiBucketConfigFirst() {
- $this->config->expects($this->exactly(2))
- ->method('getSystemValue')
- ->with('objectstore_multibucket')
- ->willReturn([
- 'class' => 'Test\Files\Mount\FakeObjectStore',
- ]);
+ $mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
+ $arguments = $this->invokePrivate($mount, 'arguments');
+
+ $objectStore = $arguments['objectstore'];
+ $this->assertInstanceOf(FakeObjectStore::class, $objectStore);
+ $this->assertEquals(['foo' => 'bar', 'bucket' => 'awesomeBucket1', 'multibucket' => true], $objectStore->getArguments());
+ }
+
+ public function testMultiBucketConfigFirst(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'objectstore_multibucket') {
+ return [
+ 'class' => 'Test\Files\Mount\FakeObjectStore',
+ 'arguments' => [
+ 'foo' => 'bar',
+ 'bucket' => 'myBucketPrefix',
+ ],
+ ];
+ } else {
+ return $default;
+ }
+ });
$this->user->method('getUID')
->willReturn('uid');
@@ -203,18 +209,18 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertInstanceOf('OC\Files\Mount\MountPoint', $mount);
}
- public function testMultiBucketConfigFirstFallBackSingle() {
- $this->config->expects($this->exactly(2))
- ->method('getSystemValue')
- ->withConsecutive(
- [$this->equalTo('objectstore_multibucket')],
- [$this->equalTo('objectstore')],
- )->willReturnOnConsecutiveCalls(
- '',
- [
+ public function testMultiBucketConfigFirstFallBackSingle(): void {
+ $this->config
+ ->method('getSystemValue')->willReturnMap([
+ ['objectstore_multibucket', null, null],
+ ['objectstore', null, [
'class' => 'Test\Files\Mount\FakeObjectStore',
- ],
- );
+ 'arguments' => [
+ 'foo' => 'bar',
+ 'bucket' => 'myBucketPrefix',
+ ],
+ ]],
+ ]);
$this->user->method('getUID')
->willReturn('uid');
@@ -224,24 +230,42 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertInstanceOf('OC\Files\Mount\MountPoint', $mount);
}
- public function testNoObjectStore() {
- $this->config->expects($this->exactly(2))
- ->method('getSystemValue')
- ->willReturn('');
+ public function testNoObjectStore(): void {
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ return $default;
+ });
$mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
$this->assertNull($mount);
}
}
-class FakeObjectStore {
- private $arguments;
-
- public function __construct(array $arguments) {
- $this->arguments = $arguments;
+class FakeObjectStore implements IObjectStore {
+ public function __construct(
+ private array $arguments,
+ ) {
}
public function getArguments() {
return $this->arguments;
}
+
+ public function getStorageId() {
+ }
+
+ public function readObject($urn) {
+ }
+
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
+ }
+
+ public function deleteObject($urn) {
+ }
+
+ public function objectExists($urn) {
+ }
+
+ public function copyObject($from, $to) {
+ }
}
diff --git a/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
index b22224aa7db..9060bf0d5f5 100644
--- a/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
@@ -43,7 +43,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
$this->provider = new ObjectStorePreviewCacheMountProvider($this->logger, $this->config);
}
- public function testNoMultibucketObjectStorage() {
+ public function testNoMultibucketObjectStorage(): void {
$this->config->expects($this->once())
->method('getSystemValue')
->with('objectstore_multibucket')
@@ -52,7 +52,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
$this->assertEquals([], $this->provider->getRootMounts($this->loader));
}
- public function testMultibucketObjectStorage() {
+ public function testMultibucketObjectStorage(): void {
$objectstoreConfig = [
'class' => S3::class,
'arguments' => [
diff --git a/tests/lib/Files/Mount/RootMountProviderTest.php b/tests/lib/Files/Mount/RootMountProviderTest.php
index 4a5048d2863..bf29bfa070a 100644
--- a/tests/lib/Files/Mount/RootMountProviderTest.php
+++ b/tests/lib/Files/Mount/RootMountProviderTest.php
@@ -10,11 +10,12 @@ namespace Test\Files\Mount;
use OC\Files\Mount\RootMountProvider;
use OC\Files\ObjectStore\ObjectStoreStorage;
+use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
use OC\Files\ObjectStore\S3;
use OC\Files\Storage\LocalRootStorage;
use OC\Files\Storage\StorageFactory;
+use OCP\App\IAppManager;
use OCP\IConfig;
-use Psr\Log\LoggerInterface;
use Test\TestCase;
/**
@@ -40,11 +41,11 @@ class RootMountProviderTest extends TestCase {
private function getProvider(array $systemConfig): RootMountProvider {
$config = $this->getConfig($systemConfig);
- $provider = new RootMountProvider($config, $this->createMock(LoggerInterface::class));
- return $provider;
+ $objectStoreConfig = new PrimaryObjectStoreConfig($config, $this->createMock(IAppManager::class));
+ return new RootMountProvider($objectStoreConfig, $config);
}
- public function testLocal() {
+ public function testLocal(): void {
$provider = $this->getProvider([
'datadirectory' => '/data',
]);
@@ -58,20 +59,20 @@ class RootMountProviderTest extends TestCase {
$this->assertEquals('/data/', $storage->getSourcePath(''));
}
- public function testObjectStore() {
+ public function testObjectStore(): void {
$provider = $this->getProvider([
'objectstore' => [
- "class" => "OC\Files\ObjectStore\S3",
- "arguments" => [
- "bucket" => "nextcloud",
- "autocreate" => true,
- "key" => "minio",
- "secret" => "minio123",
- "hostname" => "localhost",
- "port" => 9000,
- "use_ssl" => false,
- "use_path_style" => true,
- "uploadPartSize" => 52428800,
+ 'class' => "OC\Files\ObjectStore\S3",
+ 'arguments' => [
+ 'bucket' => 'nextcloud',
+ 'autocreate' => true,
+ 'key' => 'minio',
+ 'secret' => 'minio123',
+ 'hostname' => 'localhost',
+ 'port' => 9000,
+ 'use_ssl' => false,
+ 'use_path_style' => true,
+ 'uploadPartSize' => 52428800,
],
],
]);
@@ -91,20 +92,20 @@ class RootMountProviderTest extends TestCase {
$this->assertEquals('nextcloud', $objectStore->getBucket());
}
- public function testObjectStoreMultiBucket() {
+ public function testObjectStoreMultiBucket(): void {
$provider = $this->getProvider([
'objectstore_multibucket' => [
- "class" => "OC\Files\ObjectStore\S3",
- "arguments" => [
- "bucket" => "nextcloud",
- "autocreate" => true,
- "key" => "minio",
- "secret" => "minio123",
- "hostname" => "localhost",
- "port" => 9000,
- "use_ssl" => false,
- "use_path_style" => true,
- "uploadPartSize" => 52428800,
+ 'class' => "OC\Files\ObjectStore\S3",
+ 'arguments' => [
+ 'bucket' => 'nextcloud',
+ 'autocreate' => true,
+ 'key' => 'minio',
+ 'secret' => 'minio123',
+ 'hostname' => 'localhost',
+ 'port' => 9000,
+ 'use_ssl' => false,
+ 'use_path_style' => true,
+ 'uploadPartSize' => 52428800,
],
],
]);