ServerTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. * @author Vincent Petry <vincent@nextcloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\DAV\Tests\unit;
  28. use OCA\DAV\Server;
  29. use OCP\IRequest;
  30. /**
  31. * Class ServerTest
  32. *
  33. * @group DB
  34. *
  35. * @package OCA\DAV\Tests\Unit
  36. */
  37. class ServerTest extends \Test\TestCase {
  38. /**
  39. * @dataProvider providesUris
  40. */
  41. public function test($uri, array $plugins): void {
  42. /** @var IRequest | \PHPUnit\Framework\MockObject\MockObject $r */
  43. $r = $this->createMock(IRequest::class);
  44. $r->expects($this->any())->method('getRequestUri')->willReturn($uri);
  45. $s = new Server($r, '/');
  46. $this->assertNotNull($s->server);
  47. foreach ($plugins as $plugin) {
  48. $this->assertNotNull($s->server->getPlugin($plugin));
  49. }
  50. }
  51. public function providesUris() {
  52. return [
  53. 'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
  54. 'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
  55. 'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
  56. ];
  57. }
  58. }