PluginTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCA\DAV\Tests\unit\CalDAV;
  27. use OCA\DAV\CalDAV\Plugin;
  28. use Test\TestCase;
  29. class PluginTest extends TestCase {
  30. /** @var Plugin */
  31. private $plugin;
  32. protected function setUp(): void {
  33. parent::setUp();
  34. $this->plugin = new Plugin();
  35. }
  36. public function linkProvider() {
  37. return [
  38. [
  39. 'principals/users/MyUserName',
  40. 'calendars/MyUserName',
  41. ],
  42. [
  43. 'principals/calendar-resources/Resource-ABC',
  44. 'system-calendars/calendar-resources/Resource-ABC',
  45. ],
  46. [
  47. 'principals/calendar-rooms/Room-ABC',
  48. 'system-calendars/calendar-rooms/Room-ABC',
  49. ],
  50. ];
  51. }
  52. /**
  53. * @dataProvider linkProvider
  54. *
  55. * @param $input
  56. * @param $expected
  57. */
  58. public function testGetCalendarHomeForPrincipal($input, $expected) {
  59. $this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
  60. }
  61. public function testGetCalendarHomeForUnknownPrincipal() {
  62. $this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
  63. }
  64. }