2016-11-09 05:52:40 -05:00
|
|
|
<?php
|
2025-05-24 17:00:05 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2016-11-09 05:52:40 -05:00
|
|
|
/**
|
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;
|
|
|
|
|
|
|
|
|
|
class PluginTest extends TestCase {
|
2025-05-24 17:00:05 -04:00
|
|
|
private Plugin $plugin;
|
2016-11-09 05:52:40 -05:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 17:00:05 -04:00
|
|
|
public static function linkProvider(): array {
|
2016-11-09 05:52:40 -05:00
|
|
|
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
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-30 10:56:59 -04:00
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('linkProvider')]
|
2025-05-24 17:00:05 -04:00
|
|
|
public function testGetCalendarHomeForPrincipal(string $input, string $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
|
|
|
}
|