1
0

PluginTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\DAV\Tests\unit\CalDAV;
  7. use OCA\DAV\CalDAV\Plugin;
  8. use Test\TestCase;
  9. class PluginTest extends TestCase {
  10. /** @var Plugin */
  11. private $plugin;
  12. protected function setUp(): void {
  13. parent::setUp();
  14. $this->plugin = new Plugin();
  15. }
  16. public function linkProvider() {
  17. return [
  18. [
  19. 'principals/users/MyUserName',
  20. 'calendars/MyUserName',
  21. ],
  22. [
  23. 'principals/calendar-resources/Resource-ABC',
  24. 'system-calendars/calendar-resources/Resource-ABC',
  25. ],
  26. [
  27. 'principals/calendar-rooms/Room-ABC',
  28. 'system-calendars/calendar-rooms/Room-ABC',
  29. ],
  30. ];
  31. }
  32. /**
  33. * @dataProvider linkProvider
  34. *
  35. * @param $input
  36. * @param $expected
  37. */
  38. public function testGetCalendarHomeForPrincipal($input, $expected): void {
  39. $this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
  40. }
  41. public function testGetCalendarHomeForUnknownPrincipal(): void {
  42. $this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
  43. }
  44. }