CapabilitiesTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\DAV\Tests\unit;
  7. use OCA\DAV\Capabilities;
  8. use OCP\IConfig;
  9. use Test\TestCase;
  10. /**
  11. * @package OCA\DAV\Tests\unit
  12. */
  13. class CapabilitiesTest extends TestCase {
  14. public function testGetCapabilities(): void {
  15. $config = $this->createMock(IConfig::class);
  16. $config->expects($this->once())
  17. ->method('getSystemValueBool')
  18. ->with('bulkupload.enabled', $this->isType('bool'))
  19. ->willReturn(false);
  20. $capabilities = new Capabilities($config);
  21. $expected = [
  22. 'dav' => [
  23. 'chunking' => '1.0',
  24. ],
  25. ];
  26. $this->assertSame($expected, $capabilities->getCapabilities());
  27. }
  28. public function testGetCapabilitiesWithBulkUpload(): void {
  29. $config = $this->createMock(IConfig::class);
  30. $config->expects($this->once())
  31. ->method('getSystemValueBool')
  32. ->with('bulkupload.enabled', $this->isType('bool'))
  33. ->willReturn(true);
  34. $capabilities = new Capabilities($config);
  35. $expected = [
  36. 'dav' => [
  37. 'chunking' => '1.0',
  38. 'bulkupload' => '1.0',
  39. ],
  40. ];
  41. $this->assertSame($expected, $capabilities->getCapabilities());
  42. }
  43. }