1
0

ServerTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Tests\unit;
  8. use OCA\DAV\Server;
  9. use OCP\IRequest;
  10. /**
  11. * Class ServerTest
  12. *
  13. * @group DB
  14. *
  15. * @package OCA\DAV\Tests\Unit
  16. */
  17. class ServerTest extends \Test\TestCase {
  18. /**
  19. * @dataProvider providesUris
  20. */
  21. public function test($uri, array $plugins): void {
  22. /** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
  23. $r = $this->createMock(IRequest::class);
  24. $r->expects($this->any())->method('getRequestUri')->willReturn($uri);
  25. $this->loginAsUser('admin');
  26. $s = new Server($r, '/');
  27. $this->assertNotNull($s->server);
  28. foreach ($plugins as $plugin) {
  29. $this->assertNotNull($s->server->getPlugin($plugin));
  30. }
  31. }
  32. public function providesUris() {
  33. return [
  34. 'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
  35. 'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
  36. 'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
  37. ];
  38. }
  39. }