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 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\AppInfo\PluginManager;
  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) {
  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. }