77
88use OCA \DAV \Capabilities ;
99use OCP \IConfig ;
10+ use OCP \User \IAvailabilityCoordinator ;
1011use Test \TestCase ;
1112
1213/**
@@ -19,7 +20,11 @@ public function testGetCapabilities(): void {
1920 ->method ('getSystemValueBool ' )
2021 ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
2122 ->willReturn (false );
22- $ capabilities = new Capabilities ($ config );
23+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
24+ $ coordinator ->expects ($ this ->once ())
25+ ->method ('isEnabled ' )
26+ ->willReturn (false );
27+ $ capabilities = new Capabilities ($ config , $ coordinator );
2328 $ expected = [
2429 'dav ' => [
2530 'chunking ' => '1.0 ' ,
@@ -34,7 +39,11 @@ public function testGetCapabilitiesWithBulkUpload(): void {
3439 ->method ('getSystemValueBool ' )
3540 ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
3641 ->willReturn (true );
37- $ capabilities = new Capabilities ($ config );
42+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
43+ $ coordinator ->expects ($ this ->once ())
44+ ->method ('isEnabled ' )
45+ ->willReturn (false );
46+ $ capabilities = new Capabilities ($ config , $ coordinator );
3847 $ expected = [
3948 'dav ' => [
4049 'chunking ' => '1.0 ' ,
@@ -43,4 +52,25 @@ public function testGetCapabilitiesWithBulkUpload(): void {
4352 ];
4453 $ this ->assertSame ($ expected , $ capabilities ->getCapabilities ());
4554 }
55+
56+ public function testGetCapabilitiesWithAbsence (): void {
57+ $ config = $ this ->createMock (IConfig::class);
58+ $ config ->expects ($ this ->once ())
59+ ->method ('getSystemValueBool ' )
60+ ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
61+ ->willReturn (false );
62+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
63+ $ coordinator ->expects ($ this ->once ())
64+ ->method ('isEnabled ' )
65+ ->willReturn (true );
66+ $ capabilities = new Capabilities ($ config , $ coordinator );
67+ $ expected = [
68+ 'dav ' => [
69+ 'chunking ' => '1.0 ' ,
70+ 'absence-supported ' => true ,
71+ 'absence-replacement ' => true ,
72+ ],
73+ ];
74+ $ this ->assertSame ($ expected , $ capabilities ->getCapabilities ());
75+ }
4676}
0 commit comments