You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nextcloud-server/apps/dav/tests/unit/CalDAV/PluginTest.php

51 lines
1.1 KiB

<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Tests\unit\CalDAV;
use OCA\DAV\CalDAV\Plugin;
use Test\TestCase;
class PluginTest extends TestCase {
/** @var Plugin */
private $plugin;
protected function setUp(): void {
parent::setUp();
$this->plugin = new Plugin();
}
public function linkProvider() {
return [
[
'principals/users/MyUserName',
'calendars/MyUserName',
],
[
'principals/calendar-resources/Resource-ABC',
'system-calendars/calendar-resources/Resource-ABC',
],
[
'principals/calendar-rooms/Room-ABC',
'system-calendars/calendar-rooms/Room-ABC',
],
];
}
/**
* @dataProvider linkProvider
*
* @param $input
* @param $expected
*/
public function testGetCalendarHomeForPrincipal($input, $expected): void {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}
public function testGetCalendarHomeForUnknownPrincipal(): void {
$this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
}
}