|
|
|
|
@ -7,6 +7,7 @@ namespace OCA\DAV\Tests\unit; |
|
|
|
|
|
|
|
|
|
use OCA\DAV\Capabilities; |
|
|
|
|
use OCP\IConfig; |
|
|
|
|
use OCP\User\IAvailabilityCoordinator; |
|
|
|
|
use Test\TestCase; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -19,7 +20,11 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
->method('getSystemValueBool') |
|
|
|
|
->with('bulkupload.enabled', $this->isType('bool')) |
|
|
|
|
->willReturn(false); |
|
|
|
|
$capabilities = new Capabilities($config); |
|
|
|
|
$coordinator = $this->createMock(IAvailabilityCoordinator::class); |
|
|
|
|
$coordinator->expects($this->once()) |
|
|
|
|
->method('isEnabled') |
|
|
|
|
->willReturn(false); |
|
|
|
|
$capabilities = new Capabilities($config, $coordinator); |
|
|
|
|
$expected = [ |
|
|
|
|
'dav' => [ |
|
|
|
|
'chunking' => '1.0', |
|
|
|
|
@ -34,7 +39,11 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
->method('getSystemValueBool') |
|
|
|
|
->with('bulkupload.enabled', $this->isType('bool')) |
|
|
|
|
->willReturn(true); |
|
|
|
|
$capabilities = new Capabilities($config); |
|
|
|
|
$coordinator = $this->createMock(IAvailabilityCoordinator::class); |
|
|
|
|
$coordinator->expects($this->once()) |
|
|
|
|
->method('isEnabled') |
|
|
|
|
->willReturn(false); |
|
|
|
|
$capabilities = new Capabilities($config, $coordinator); |
|
|
|
|
$expected = [ |
|
|
|
|
'dav' => [ |
|
|
|
|
'chunking' => '1.0', |
|
|
|
|
@ -43,4 +52,24 @@ class CapabilitiesTest extends TestCase { |
|
|
|
|
]; |
|
|
|
|
$this->assertSame($expected, $capabilities->getCapabilities()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetCapabilitiesWithAbsence(): void { |
|
|
|
|
$config = $this->createMock(IConfig::class); |
|
|
|
|
$config->expects($this->once()) |
|
|
|
|
->method('getSystemValueBool') |
|
|
|
|
->with('bulkupload.enabled', $this->isType('bool')) |
|
|
|
|
->willReturn(false); |
|
|
|
|
$coordinator = $this->createMock(IAvailabilityCoordinator::class); |
|
|
|
|
$coordinator->expects($this->once()) |
|
|
|
|
->method('isEnabled') |
|
|
|
|
->willReturn(true); |
|
|
|
|
$capabilities = new Capabilities($config, $coordinator); |
|
|
|
|
$expected = [ |
|
|
|
|
'dav' => [ |
|
|
|
|
'chunking' => '1.0', |
|
|
|
|
'absence-supported' => true, |
|
|
|
|
], |
|
|
|
|
]; |
|
|
|
|
$this->assertSame($expected, $capabilities->getCapabilities()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|