]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix Capabilities tests for dav application
authorCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 29 Aug 2022 13:24:58 +0000 (15:24 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 29 Aug 2022 13:24:58 +0000 (15:24 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/dav/tests/unit/CapabilitiesTest.php

index 7abfd08854b7d11c0541b0dc8ba690086fc6fb8b..6a9a0c1180a82d8fd5e859c89e64213354f5db3c 100644 (file)
@@ -24,6 +24,7 @@
 namespace OCA\DAV\Tests\unit;
 
 use OCA\DAV\Capabilities;
+use OCP\IConfig;
 use Test\TestCase;
 
 /**
@@ -31,12 +32,31 @@ use Test\TestCase;
  */
 class CapabilitiesTest extends TestCase {
        public function testGetCapabilities() {
-               $capabilities = new Capabilities();
+               $config = $this->createMock(IConfig::class);
+               $config->expects($this->once())
+                       ->method('getSystemValueBool')
+                       ->with('bulkupload.enabled', $this->isType('bool'))
+                       ->willReturn(false);
+               $capabilities = new Capabilities($config);
                $expected = [
                        'dav' => [
                                'chunking' => '1.0',
-                               // disabled because of https://github.com/nextcloud/desktop/issues/4243
-                               // 'bulkupload' => '1.0',
+                       ],
+               ];
+               $this->assertSame($expected, $capabilities->getCapabilities());
+       }
+
+       public function testGetCapabilitiesWithBulkUpload() {
+               $config = $this->createMock(IConfig::class);
+               $config->expects($this->once())
+                       ->method('getSystemValueBool')
+                       ->with('bulkupload.enabled', $this->isType('bool'))
+                       ->willReturn(true);
+               $capabilities = new Capabilities($config);
+               $expected = [
+                       'dav' => [
+                               'chunking' => '1.0',
+                               'bulkupload' => '1.0',
                        ],
                ];
                $this->assertSame($expected, $capabilities->getCapabilities());