aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/CapabilitiesTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/CapabilitiesTest.php')
-rw-r--r--apps/dav/tests/unit/CapabilitiesTest.php61
1 files changed, 39 insertions, 22 deletions
diff --git a/apps/dav/tests/unit/CapabilitiesTest.php b/apps/dav/tests/unit/CapabilitiesTest.php
index 16f46c4c607..ad70d576d48 100644
--- a/apps/dav/tests/unit/CapabilitiesTest.php
+++ b/apps/dav/tests/unit/CapabilitiesTest.php
@@ -1,30 +1,15 @@
<?php
+
+declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Tests\unit;
use OCA\DAV\Capabilities;
use OCP\IConfig;
+use OCP\User\IAvailabilityCoordinator;
use Test\TestCase;
/**
@@ -37,10 +22,15 @@ class CapabilitiesTest extends TestCase {
->method('getSystemValueBool')
->with('bulkupload.enabled', $this->isType('bool'))
->willReturn(false);
- $capabilities = new Capabilities($config);
+ $coordinator = $this->createMock(IAvailabilityCoordinator::class);
+ $coordinator->expects($this->once())
+ ->method('isEnabled')
+ ->willReturn(false);
+ $capabilities = new Capabilities($config, $coordinator);
$expected = [
'dav' => [
'chunking' => '1.0',
+ 'public_shares_chunking' => true,
],
];
$this->assertSame($expected, $capabilities->getCapabilities());
@@ -52,13 +42,40 @@ class CapabilitiesTest extends TestCase {
->method('getSystemValueBool')
->with('bulkupload.enabled', $this->isType('bool'))
->willReturn(true);
- $capabilities = new Capabilities($config);
+ $coordinator = $this->createMock(IAvailabilityCoordinator::class);
+ $coordinator->expects($this->once())
+ ->method('isEnabled')
+ ->willReturn(false);
+ $capabilities = new Capabilities($config, $coordinator);
$expected = [
'dav' => [
'chunking' => '1.0',
+ 'public_shares_chunking' => true,
'bulkupload' => '1.0',
],
];
$this->assertSame($expected, $capabilities->getCapabilities());
}
+
+ public function testGetCapabilitiesWithAbsence(): void {
+ $config = $this->createMock(IConfig::class);
+ $config->expects($this->once())
+ ->method('getSystemValueBool')
+ ->with('bulkupload.enabled', $this->isType('bool'))
+ ->willReturn(false);
+ $coordinator = $this->createMock(IAvailabilityCoordinator::class);
+ $coordinator->expects($this->once())
+ ->method('isEnabled')
+ ->willReturn(true);
+ $capabilities = new Capabilities($config, $coordinator);
+ $expected = [
+ 'dav' => [
+ 'chunking' => '1.0',
+ 'public_shares_chunking' => true,
+ 'absence-supported' => true,
+ 'absence-replacement' => true,
+ ],
+ ];
+ $this->assertSame($expected, $capabilities->getCapabilities());
+ }
}