ServerTest.php 1.8 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 Roeland Jago Douma <roeland@famdouma.nl>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Vincent Petry <pvince81@owncloud.com>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  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, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\DAV\Tests\unit;
  27. use OCA\DAV\Server;
  28. use OCP\IRequest;
  29. /**
  30. * Class ServerTest
  31. *
  32. * @group DB
  33. *
  34. * @package OCA\DAV\Tests\Unit
  35. */
  36. class ServerTest extends \Test\TestCase {
  37. /**
  38. * @dataProvider providesUris
  39. */
  40. public function test($uri, array $plugins) {
  41. /** @var IRequest | \PHPUnit_Framework_MockObject_MockObject $r */
  42. $r = $this->createMock(IRequest::class);
  43. $r->expects($this->any())->method('getRequestUri')->willReturn($uri);
  44. $s = new Server($r, '/');
  45. $this->assertNotNull($s->server);
  46. foreach ($plugins as $plugin) {
  47. $this->assertNotNull($s->server->getPlugin($plugin));
  48. }
  49. }
  50. public function providesUris() {
  51. return [
  52. 'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
  53. 'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
  54. 'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
  55. ];
  56. }
  57. }