2525
2626use OCA \DAV \Capabilities ;
2727use OCP \IConfig ;
28+ use OCP \User \IAvailabilityCoordinator ;
2829use Test \TestCase ;
2930
3031/**
@@ -37,7 +38,11 @@ public function testGetCapabilities(): void {
3738 ->method ('getSystemValueBool ' )
3839 ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
3940 ->willReturn (false );
40- $ capabilities = new Capabilities ($ config );
41+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
42+ $ coordinator ->expects ($ this ->once ())
43+ ->method ('isEnabled ' )
44+ ->willReturn (false );
45+ $ capabilities = new Capabilities ($ config , $ coordinator );
4146 $ expected = [
4247 'dav ' => [
4348 'chunking ' => '1.0 ' ,
@@ -52,7 +57,11 @@ public function testGetCapabilitiesWithBulkUpload(): void {
5257 ->method ('getSystemValueBool ' )
5358 ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
5459 ->willReturn (true );
55- $ capabilities = new Capabilities ($ config );
60+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
61+ $ coordinator ->expects ($ this ->once ())
62+ ->method ('isEnabled ' )
63+ ->willReturn (false );
64+ $ capabilities = new Capabilities ($ config , $ coordinator );
5665 $ expected = [
5766 'dav ' => [
5867 'chunking ' => '1.0 ' ,
@@ -61,4 +70,24 @@ public function testGetCapabilitiesWithBulkUpload(): void {
6170 ];
6271 $ this ->assertSame ($ expected , $ capabilities ->getCapabilities ());
6372 }
73+
74+ public function testGetCapabilitiesWithAbsence (): void {
75+ $ config = $ this ->createMock (IConfig::class);
76+ $ config ->expects ($ this ->once ())
77+ ->method ('getSystemValueBool ' )
78+ ->with ('bulkupload.enabled ' , $ this ->isType ('bool ' ))
79+ ->willReturn (false );
80+ $ coordinator = $ this ->createMock (IAvailabilityCoordinator::class);
81+ $ coordinator ->expects ($ this ->once ())
82+ ->method ('isEnabled ' )
83+ ->willReturn (true );
84+ $ capabilities = new Capabilities ($ config , $ coordinator );
85+ $ expected = [
86+ 'dav ' => [
87+ 'chunking ' => '1.0 ' ,
88+ 'absence-supported ' => true ,
89+ ],
90+ ];
91+ $ this ->assertSame ($ expected , $ capabilities ->getCapabilities ());
92+ }
6493}
0 commit comments