aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/ConfigTest.php7
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php6
-rw-r--r--tests/lib/Encryption/EncryptionWrapperTest.php7
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php4
-rw-r--r--tests/lib/Files/Node/FolderTest.php18
-rw-r--r--tests/lib/Files/Node/NodeTest.php4
-rw-r--r--tests/lib/Files/Storage/Storage.php3
-rw-r--r--tests/lib/Files/Storage/StorageFactoryTest.php2
-rw-r--r--tests/lib/Lockdown/Filesystem/NullStorageTest.php8
-rw-r--r--tests/lib/Mail/MailerTest.php3
-rw-r--r--tests/lib/SetupCheck/CheckServerResponseTraitImplementation.php39
-rw-r--r--tests/lib/SetupCheck/CheckServerResponseTraitTest.php213
-rw-r--r--tests/lib/Share20/ManagerTest.php26
13 files changed, 301 insertions, 39 deletions
diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php
index 60006aa43de..94ee8da5dec 100644
--- a/tests/lib/ConfigTest.php
+++ b/tests/lib/ConfigTest.php
@@ -41,6 +41,13 @@ class ConfigTest extends TestCase {
$this->assertSame($expectedConfig, $this->getConfig()->getKeys());
}
+ public function testGetKeysReturnsEnvironmentKeysIfSet() {
+ $expectedConfig = ['foo', 'beers', 'alcohol_free', 'taste'];
+ putenv('NC_taste=great');
+ $this->assertSame($expectedConfig, $this->getConfig()->getKeys());
+ putenv('NC_taste');
+ }
+
public function testGetValue(): void {
$config = $this->getConfig();
$this->assertSame('bar', $config->getValue('foo'));
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index d073efc8235..6a8453bcaf8 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -12,7 +12,7 @@ use OC\Encryption\Exceptions\DecryptionFailedException;
use OC\Encryption\Manager;
use OC\Files\FileInfo;
use OC\Files\View;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
use OCP\IUserManager;
use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
@@ -246,11 +246,11 @@ class DecryptAllTest extends TestCase {
->setMethods(['decryptFile'])
->getMock();
- $storage = $this->getMockBuilder(Storage::class)
+ $storage = $this->getMockBuilder(IStorage::class)
->disableOriginalConstructor()->getMock();
- $sharedStorage = $this->getMockBuilder(Storage::class)
+ $sharedStorage = $this->getMockBuilder(IStorage::class)
->disableOriginalConstructor()->getMock();
$sharedStorage->expects($this->once())->method('instanceOfStorage')
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php
index 1ecb9dc89c7..1ac7342a3d8 100644
--- a/tests/lib/Encryption/EncryptionWrapperTest.php
+++ b/tests/lib/Encryption/EncryptionWrapperTest.php
@@ -10,7 +10,8 @@ namespace Test\Encryption;
use OC\Encryption\EncryptionWrapper;
use OC\Encryption\Manager;
use OC\Memcache\ArrayCache;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IDisableEncryptionStorage;
+use OCP\Files\Storage\IStorage;
use Psr\Log\LoggerInterface;
use Test\TestCase;
@@ -42,7 +43,7 @@ class EncryptionWrapperTest extends TestCase {
* @dataProvider provideWrapStorage
*/
public function testWrapStorage($expectedWrapped, $wrappedStorages): void {
- $storage = $this->getMockBuilder(Storage::class)
+ $storage = $this->getMockBuilder(IStorage::class)
->disableOriginalConstructor()
->getMock();
@@ -74,7 +75,7 @@ class EncryptionWrapperTest extends TestCase {
[true, ['OCA\Files_Trashbin\Storage']],
// Do not wrap shared storages
- [false, [Storage\IDisableEncryptionStorage::class]],
+ [false, [IDisableEncryptionStorage::class]],
];
}
}
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index eda61feb249..3de54e315a1 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -8,14 +8,14 @@
namespace Test\Files\Mount;
use OC\Files\Storage\StorageFactory;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
class DummyStorage {
}
class MountPointTest extends \Test\TestCase {
public function testGetStorage(): void {
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->expects($this->once())
->method('getId')
->willReturn(123);
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index 2e3b6e369d3..5af409a1a93 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -28,7 +28,7 @@ use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOrder;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
use PHPUnit\Framework\MockObject\MockObject;
/**
@@ -292,7 +292,7 @@ class FolderTest extends NodeTest {
$root->method('getUser')
->willReturn($this->user);
/** @var Storage\IStorage&MockObject $storage */
- $storage = $this->createMock(Storage\IStorage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('getId')->willReturn('test::1');
$cache = new Cache($storage);
@@ -341,7 +341,7 @@ class FolderTest extends NodeTest {
->method('getUser')
->willReturn($this->user);
/** @var \PHPUnit\Framework\MockObject\MockObject|Storage $storage */
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('getId')->willReturn('test::2');
$cache = new Cache($storage);
@@ -379,7 +379,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->method('getUser')
->willReturn($this->user);
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('getId')->willReturn('test::1');
$cache = new Cache($storage);
@@ -420,10 +420,10 @@ class FolderTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
->willReturn($this->user);
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('getId')->willReturn('test::1');
$cache = new Cache($storage);
- $subStorage = $this->createMock(Storage::class);
+ $subStorage = $this->createMock(IStorage::class);
$subStorage->method('getId')->willReturn('test::2');
$subCache = new Cache($subStorage);
$subMount = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
@@ -922,14 +922,14 @@ class FolderTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
->willReturn($this->user);
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('getId')->willReturn('test::1');
$cache = new Cache($storage);
- $subStorage1 = $this->createMock(Storage::class);
+ $subStorage1 = $this->createMock(IStorage::class);
$subStorage1->method('getId')->willReturn('test::2');
$subCache1 = new Cache($subStorage1);
$subMount1 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
- $subStorage2 = $this->createMock(Storage::class);
+ $subStorage2 = $this->createMock(IStorage::class);
$subStorage2->method('getId')->willReturn('test::3');
$subCache2 = new Cache($subStorage2);
$subMount2 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index d12448a2481..db87aa925d3 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -16,7 +16,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
use OCP\ICacheFactory;
use OCP\IUser;
use OCP\IUserManager;
@@ -111,7 +111,7 @@ abstract class NodeTest extends \Test\TestCase {
abstract protected function getViewDeleteMethod();
protected function getMockStorage() {
- $storage = $this->getMockBuilder(Storage::class)
+ $storage = $this->getMockBuilder(IStorage::class)
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index 5b0bbf2f95b..36d70965848 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -8,6 +8,7 @@
namespace Test\Files\Storage;
use OC\Files\Cache\Watcher;
+use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IWriteStreamStorage;
abstract class Storage extends \Test\TestCase {
@@ -572,7 +573,7 @@ abstract class Storage extends \Test\TestCase {
}
public function testInstanceOfStorage(): void {
- $this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage'));
+ $this->assertTrue($this->instance->instanceOfStorage(IStorage::class));
$this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance)));
$this->assertFalse($this->instance->instanceOfStorage('\OC'));
}
diff --git a/tests/lib/Files/Storage/StorageFactoryTest.php b/tests/lib/Files/Storage/StorageFactoryTest.php
index 66f2a2af9a6..d1e8d927dc9 100644
--- a/tests/lib/Files/Storage/StorageFactoryTest.php
+++ b/tests/lib/Files/Storage/StorageFactoryTest.php
@@ -10,7 +10,7 @@ namespace Test\Files\Storage;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Files\Mount\IMountPoint;
-use OCP\Files\Storage as IStorage;
+use OCP\Files\Storage\IStorage;
use Test\TestCase;
class DummyWrapper extends Wrapper {
diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
index 331adeb8a54..a0b9b04ad1a 100644
--- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
@@ -11,7 +11,7 @@ use OC\Files\FileInfo;
use OC\ForbiddenException;
use OC\Lockdown\Filesystem\NullCache;
use OC\Lockdown\Filesystem\NullStorage;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
use Test\TestCase;
class NullStorageTest extends TestCase {
@@ -196,7 +196,7 @@ class NullStorageTest extends TestCase {
}
public function testCopyFromStorage(): void {
- $sourceStorage = $this->createMock(Storage::class);
+ $sourceStorage = $this->createMock(IStorage::class);
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
@@ -205,7 +205,7 @@ class NullStorageTest extends TestCase {
}
public function testMoveFromStorage(): void {
- $sourceStorage = $this->createMock(Storage::class);
+ $sourceStorage = $this->createMock(IStorage::class);
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
@@ -219,7 +219,7 @@ class NullStorageTest extends TestCase {
}
public function testGetOwner(): void {
- $this->assertNull($this->storage->getOwner('foo'));
+ $this->assertFalse($this->storage->getOwner('foo'));
}
public function testGetCache(): void {
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 9f37b776f17..f215e385e3f 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -12,6 +12,7 @@ use OC\Mail\Mailer;
use OC\Mail\Message;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IBinaryFinder;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
@@ -86,7 +87,7 @@ class MailerTest extends TestCase {
['mail_sendmailmode', 'smtp', $sendmailMode],
]);
- $path = \OC_Helper::findBinaryPath('sendmail');
+ $path = \OCP\Server::get(IBinaryFinder::class)->findBinaryPath('sendmail');
if ($path === false) {
$path = '/usr/sbin/sendmail';
}
diff --git a/tests/lib/SetupCheck/CheckServerResponseTraitImplementation.php b/tests/lib/SetupCheck/CheckServerResponseTraitImplementation.php
new file mode 100644
index 00000000000..1119c5ed0d9
--- /dev/null
+++ b/tests/lib/SetupCheck/CheckServerResponseTraitImplementation.php
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\SetupCheck;
+
+use OCP\Http\Client\IClientService;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use OCP\SetupCheck\CheckServerResponseTrait;
+use Psr\Log\LoggerInterface;
+
+/**
+ * Dummy implementation for CheckServerResponseTraitTest
+ */
+class CheckServerResponseTraitImplementation {
+
+ use CheckServerResponseTrait {
+ CheckServerResponseTrait::getRequestOptions as public;
+ CheckServerResponseTrait::runRequest as public;
+ CheckServerResponseTrait::normalizeUrl as public;
+ CheckServerResponseTrait::getTestUrls as public;
+ }
+
+ public function __construct(
+ protected IL10N $l10n,
+ protected IConfig $config,
+ protected IURLGenerator $urlGenerator,
+ protected IClientService $clientService,
+ protected LoggerInterface $logger,
+ ) {
+ }
+
+}
diff --git a/tests/lib/SetupCheck/CheckServerResponseTraitTest.php b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php
new file mode 100644
index 00000000000..32fbce64ce6
--- /dev/null
+++ b/tests/lib/SetupCheck/CheckServerResponseTraitTest.php
@@ -0,0 +1,213 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\SetupCheck;
+
+use OCP\Http\Client\IClientService;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
+use Test\TestCase;
+
+class CheckServerResponseTraitTest extends TestCase {
+
+ protected const BASE_URL = 'https://nextcloud.local';
+
+ private IL10N&MockObject $l10n;
+ private IConfig&MockObject $config;
+ private IURLGenerator&MockObject $urlGenerator;
+ private IClientService&MockObject $clientService;
+ private LoggerInterface&MockObject $logger;
+
+ private CheckServerResponseTraitImplementation $trait;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->l10n = $this->createMock(IL10N::class);
+ $this->l10n->method('t')
+ ->willReturnArgument(0);
+ $this->config = $this->createMock(IConfig::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->clientService = $this->createMock(IClientService::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+
+ $this->trait = new CheckServerResponseTraitImplementation(
+ $this->l10n,
+ $this->config,
+ $this->urlGenerator,
+ $this->clientService,
+ $this->logger,
+ );
+ }
+
+ /**
+ * @dataProvider dataNormalizeUrl
+ */
+ public function testNormalizeUrl(string $url, bool $isRootRequest, string $expected): void {
+ $this->assertEquals($expected, $this->trait->normalizeUrl($url, $isRootRequest));
+ }
+
+ public static function dataNormalizeUrl(): array {
+ return [
+ // untouched web-root
+ 'valid and nothing to change' => ['http://example.com/root', false, 'http://example.com/root'],
+ 'valid with port and nothing to change' => ['http://example.com:8081/root', false, 'http://example.com:8081/root'],
+ 'trailing slash' => ['http://example.com/root/', false, 'http://example.com/root'],
+ 'deep web root' => ['http://example.com/deep/webroot', false, 'http://example.com/deep/webroot'],
+ // removal of the web-root
+ 'remove web root' => ['http://example.com/root/', true, 'http://example.com'],
+ 'remove web root but empty' => ['http://example.com', true, 'http://example.com'],
+ 'remove deep web root' => ['http://example.com/deep/webroot', true, 'http://example.com'],
+ 'remove web root with port' => ['http://example.com:8081/root', true, 'http://example.com:8081'],
+ 'remove web root with port but empty' => ['http://example.com:8081', true, 'http://example.com:8081'],
+ 'remove web root from IP' => ['https://127.0.0.1/root', true, 'https://127.0.0.1'],
+ 'remove web root from IP with port' => ['https://127.0.0.1:8080/root', true, 'https://127.0.0.1:8080'],
+ 'remove web root from IPv6' => ['https://[ff02::1]/root', true, 'https://[ff02::1]'],
+ 'remove web root from IPv6 with port' => ['https://[ff02::1]:8080/root', true, 'https://[ff02::1]:8080'],
+ ];
+ }
+
+ /**
+ * @dataProvider dataGetTestUrls
+ */
+ public function testGetTestUrls(
+ string $url,
+ bool $isRootRequest,
+ string $cliUrl,
+ string $webRoot,
+ array $trustedDomains,
+ array $expected,
+ ): void {
+ $this->config->expects(self::atLeastOnce())
+ ->method('getSystemValueString')
+ ->with('overwrite.cli.url', '')
+ ->willReturn($cliUrl);
+
+ $this->config->expects(self::atLeastOnce())
+ ->method('getSystemValue')
+ ->with('trusted_domains', [])
+ ->willReturn($trustedDomains);
+
+ $this->urlGenerator->expects(self::atLeastOnce())
+ ->method('getWebroot')
+ ->willReturn($webRoot);
+
+ $this->urlGenerator->expects(self::atLeastOnce())
+ ->method('getBaseUrl')
+ ->willReturn(self::BASE_URL . $webRoot);
+
+ $result = $this->trait->getTestUrls($url, $isRootRequest);
+ $this->assertEquals($expected, $result);
+ }
+
+ /**
+ * @return array<string, list{string, bool, string, string, list<string>, list<string>}>
+ */
+ public static function dataGetTestUrls(): array {
+ return [
+ 'same cli and base URL' => [
+ '/apps/files/js/example.js', false, 'https://nextcloud.local', '', ['nextcloud.local'], [
+ // from cli url
+ 'https://nextcloud.local/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/apps/files/js/example.js',
+ ]
+ ],
+ 'different cli and base URL' => [
+ '/apps/files/js/example.js', false, 'https://example.com', '', ['nextcloud.local'], [
+ // from cli url
+ 'https://example.com/apps/files/js/example.js',
+ // from base url
+ 'https://nextcloud.local/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/apps/files/js/example.js',
+ ]
+ ],
+ 'different cli and base URL and trusted domains' => [
+ '/apps/files/js/example.js', false, 'https://example.com', '', ['nextcloud.local', 'example.com', '127.0.0.1'], [
+ // from cli url
+ 'https://example.com/apps/files/js/example.js',
+ // from base url
+ 'https://nextcloud.local/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/apps/files/js/example.js',
+ 'http://example.com/apps/files/js/example.js',
+ // trusted domains
+ 'https://127.0.0.1/apps/files/js/example.js',
+ 'http://127.0.0.1/apps/files/js/example.js',
+ ]
+ ],
+ 'wildcard trusted domains' => [
+ '/apps/files/js/example.js', false, '', '', ['nextcloud.local', '*.example.com'], [
+ // from base url
+ 'https://nextcloud.local/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/apps/files/js/example.js',
+ // trusted domains with wild card are skipped
+ ]
+ ],
+ 'missing leading slash' => [
+ 'apps/files/js/example.js', false, 'https://nextcloud.local', '', ['nextcloud.local'], [
+ // from cli url
+ 'https://nextcloud.local/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/apps/files/js/example.js',
+ ]
+ ],
+ 'keep web-root' => [
+ '/apps/files/js/example.js', false, 'https://example.com', '/nextcloud', ['nextcloud.local', 'example.com', '192.168.100.1'], [
+ // from cli url (note that the CLI url has NO web root)
+ 'https://example.com/apps/files/js/example.js',
+ // from base url
+ 'https://nextcloud.local/nextcloud/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/nextcloud/apps/files/js/example.js',
+ // trusted domains with web-root
+ 'https://example.com/nextcloud/apps/files/js/example.js',
+ 'http://example.com/nextcloud/apps/files/js/example.js',
+ 'https://192.168.100.1/nextcloud/apps/files/js/example.js',
+ 'http://192.168.100.1/nextcloud/apps/files/js/example.js',
+ ]
+ ],
+ // example if the URL is generated by the URL generator
+ 'keep web-root and web root in url' => [
+ '/nextcloud/apps/files/js/example.js', false, 'https://example.com', '/nextcloud', ['nextcloud.local', 'example.com', '192.168.100.1'], [
+ // from cli url (note that the CLI url has NO web root)
+ 'https://example.com/apps/files/js/example.js',
+ // from base url
+ 'https://nextcloud.local/nextcloud/apps/files/js/example.js',
+ // http variant from trusted domains
+ 'http://nextcloud.local/nextcloud/apps/files/js/example.js',
+ // trusted domains with web-root
+ 'https://example.com/nextcloud/apps/files/js/example.js',
+ 'http://example.com/nextcloud/apps/files/js/example.js',
+ 'https://192.168.100.1/nextcloud/apps/files/js/example.js',
+ 'http://192.168.100.1/nextcloud/apps/files/js/example.js',
+ ]
+ ],
+ 'remove web-root' => [
+ '/.well-known/caldav', true, 'https://example.com', '/nextcloud', ['nextcloud.local', 'example.com', '192.168.100.1'], [
+ // from cli url (note that the CLI url has NO web root)
+ 'https://example.com/.well-known/caldav',
+ // from base url
+ 'https://nextcloud.local/.well-known/caldav',
+ // http variant from trusted domains
+ 'http://nextcloud.local/.well-known/caldav',
+ 'http://example.com/.well-known/caldav',
+ // trusted domains with web-root
+ 'https://192.168.100.1/.well-known/caldav',
+ 'http://192.168.100.1/.well-known/caldav',
+ ]
+ ],
+ ];
+ }
+
+}
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 2250e28bd13..d0c43b2862c 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -23,7 +23,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountManager;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Node;
-use OCP\Files\Storage;
+use OCP\Files\Storage\IStorage;
use OCP\HintException;
use OCP\IConfig;
use OCP\IDateTimeZone;
@@ -631,7 +631,7 @@ class ManagerTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$node = $this->createMock(Node::class);
- $storage = $this->createMock(Storage\IStorage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('instanceOfStorage')
->with('\OCA\Files_Sharing\External\Storage')
->willReturn(false);
@@ -706,7 +706,7 @@ class ManagerTest extends \Test\TestCase {
$data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Cannot increase permissions of path', true];
$data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true];
- $nonMovableStorage = $this->createMock(Storage\IStorage::class);
+ $nonMovableStorage = $this->createMock(IStorage::class);
$nonMovableStorage->method('instanceOfStorage')
->with('\OCA\Files_Sharing\External\Storage')
->willReturn(false);
@@ -752,7 +752,7 @@ class ManagerTest extends \Test\TestCase {
$data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false];
- $remoteStorage = $this->createMock(Storage\IStorage::class);
+ $remoteStorage = $this->createMock(IStorage::class);
$remoteStorage->method('instanceOfStorage')
->with('\OCA\Files_Sharing\External\Storage')
->willReturn(true);
@@ -2059,7 +2059,7 @@ class ManagerTest extends \Test\TestCase {
$path->method('getPath')->willReturn('path');
$mount = $this->createMock(IMountPoint::class);
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$mount->method('getStorage')->willReturn($storage);
$storage->method('instanceOfStorage')->with('\OCA\Files_Sharing\ISharedStorage')->willReturn(true);
@@ -2073,7 +2073,7 @@ class ManagerTest extends \Test\TestCase {
$path->method('getPath')->willReturn('path');
$mount = $this->createMock(IMountPoint::class);
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$mount->method('getStorage')->willReturn($storage);
$storage->method('instanceOfStorage')->with('\OCA\Files_Sharing\ISharedStorage')->willReturn(false);
@@ -2221,7 +2221,7 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$path = $this->createMock(File::class);
$path->method('getOwner')->willReturn($shareOwner);
$path->method('getName')->willReturn('target');
@@ -2276,7 +2276,7 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$path = $this->createMock(File::class);
$path->method('getOwner')->willReturn($shareOwner);
$path->method('getName')->willReturn('target');
@@ -2339,7 +2339,7 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$path = $this->createMock(File::class);
$path->method('getOwner')->willReturn($shareOwner);
$path->method('getName')->willReturn('target');
@@ -2459,7 +2459,7 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$path = $this->createMock(File::class);
$path->method('getOwner')->willReturn($shareOwner);
$path->method('getName')->willReturn('target');
@@ -2563,7 +2563,7 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$path = $this->createMock(File::class);
$path->method('getOwner')->willReturn($shareOwner);
$path->method('getName')->willReturn('target');
@@ -2623,12 +2623,12 @@ class ManagerTest extends \Test\TestCase {
$shareOwner = $this->createMock(IUser::class);
$shareOwner->method('getUID')->willReturn('shareOwner');
- $storage = $this->createMock(Storage::class);
+ $storage = $this->createMock(IStorage::class);
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(true);
- $storage2 = $this->createMock(Storage::class);
+ $storage2 = $this->createMock(IStorage::class);
$storage2->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);