aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2024-07-13 16:51:16 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2024-07-16 09:18:33 +0200
commite42bceac9fc5845ad3614d3254bbb270e0d9d847 (patch)
tree53062f9f3ee11966417266a241c0f2800514c7ad /apps/dav/tests/unit
parent70dd8d513bf73c8d56fea2aae4a02718a328f6e3 (diff)
downloadnextcloud-server-e42bceac9fc5845ad3614d3254bbb270e0d9d847.tar.gz
nextcloud-server-e42bceac9fc5845ad3614d3254bbb270e0d9d847.zip
feat: hide caldav server settings if no app uses the caldav backend
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r--apps/dav/tests/unit/Settings/CalDAVSettingsTest.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
index 46a8db6f3eb..ed497d006e1 100644
--- a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
+++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
@@ -6,6 +6,7 @@
namespace OCA\DAV\Tests\Unit\DAV\Settings;
use OCA\DAV\Settings\CalDAVSettings;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
@@ -24,6 +25,9 @@ class CalDAVSettingsTest extends TestCase {
/** @var IURLGenerator|MockObject */
private $urlGenerator;
+ /** @var IAppManager|MockObject */
+ private $appManager;
+
private CalDAVSettings $settings;
protected function setUp(): void {
@@ -32,7 +36,8 @@ class CalDAVSettingsTest extends TestCase {
$this->config = $this->createMock(IConfig::class);
$this->initialState = $this->createMock(IInitialState::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
- $this->settings = new CalDAVSettings($this->config, $this->initialState, $this->urlGenerator);
+ $this->appManager = $this->createMock(IAppManager::class);
+ $this->settings = new CalDAVSettings($this->config, $this->initialState, $this->urlGenerator, $this->appManager);
}
public function testGetForm(): void {
@@ -65,10 +70,23 @@ class CalDAVSettingsTest extends TestCase {
}
public function testGetSection(): void {
+ $this->appManager->expects(self::once())
+ ->method('isBackendRequired')
+ ->with(IAppManager::BACKEND_CALDAV)
+ ->willReturn(true);
$this->assertEquals('groupware', $this->settings->getSection());
}
+ public function testGetSectionWithoutCaldavBackend(): void {
+ $this->appManager->expects(self::once())
+ ->method('isBackendRequired')
+ ->with(IAppManager::BACKEND_CALDAV)
+ ->willReturn(false);
+ $this->assertEquals(null, $this->settings->getSection());
+ }
+
public function testGetPriority(): void {
$this->assertEquals(10, $this->settings->getPriority());
}
+
}