blob: c5725a1fa813a7e3d1320f078f1ce32b17e2f953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
declare(strict_types=1);
/**
* 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 {
private Plugin $plugin;
protected function setUp(): void {
parent::setUp();
$this->plugin = new Plugin();
}
public static function linkProvider(): array {
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',
],
];
}
#[\PHPUnit\Framework\Attributes\DataProvider('linkProvider')]
public function testGetCalendarHomeForPrincipal(string $input, string $expected): void {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}
public function testGetCalendarHomeForUnknownPrincipal(): void {
$this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
}
}
|