1
0

ServerTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. $this->loginAsUser('admin');
  46. $s = new Server($r, '/');
  47. $this->assertNotNull($s->server);
  48. foreach ($plugins as $plugin) {
  49. $this->assertNotNull($s->server->getPlugin($plugin));
  50. }
  51. }
  52. public function providesUris() {
  53. return [
  54. 'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
  55. 'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
  56. 'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
  57. ];
  58. }
  59. }