2016-11-09 05:52:40 -05:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-28 06:34:11 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-11-09 05:52:40 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCA\DAV\Tests\unit\CalDAV;
|
|
|
|
|
|
|
|
|
|
use OCA\DAV\CalDAV\Plugin;
|
|
|
|
|
use Test\TestCase;
|
|
|
|
|
|
2020-04-10 08:19:56 -04:00
|
|
|
class PluginTest extends TestCase {
|
2016-11-09 05:52:40 -05:00
|
|
|
/** @var Plugin */
|
|
|
|
|
private $plugin;
|
|
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function setUp(): void {
|
2016-11-09 05:52:40 -05:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
|
|
$this->plugin = new Plugin();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function linkProvider() {
|
|
|
|
|
return [
|
|
|
|
|
[
|
|
|
|
|
'principals/users/MyUserName',
|
|
|
|
|
'calendars/MyUserName',
|
|
|
|
|
],
|
|
|
|
|
[
|
2018-06-05 15:26:29 -04:00
|
|
|
'principals/calendar-resources/Resource-ABC',
|
|
|
|
|
'system-calendars/calendar-resources/Resource-ABC',
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'principals/calendar-rooms/Room-ABC',
|
|
|
|
|
'system-calendars/calendar-rooms/Room-ABC',
|
2016-11-09 05:52:40 -05:00
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider linkProvider
|
|
|
|
|
*
|
|
|
|
|
* @param $input
|
|
|
|
|
* @param $expected
|
|
|
|
|
*/
|
2023-01-20 02:38:43 -05:00
|
|
|
public function testGetCalendarHomeForPrincipal($input, $expected): void {
|
2016-11-09 05:52:40 -05:00
|
|
|
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-20 02:38:43 -05:00
|
|
|
public function testGetCalendarHomeForUnknownPrincipal(): void {
|
2018-09-01 17:04:07 -04:00
|
|
|
$this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
|
2018-06-05 15:26:29 -04:00
|
|
|
}
|
2016-11-09 05:52:40 -05:00
|
|
|
}
|