@@ -82,6 +82,9 @@ class CardDavBackendTest extends TestCase {
8282 /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
8383 private $ dispatcher ;
8484
85+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
86+ private $ config ;
87+
8588 /** @var IDBConnection */
8689 private $ db ;
8790
@@ -129,6 +132,9 @@ class CardDavBackendTest extends TestCase {
129132 protected function setUp (): void {
130133 parent ::setUp ();
131134
135+ $ this ->config = $ this ->createMock (IConfig::class);
136+ $ this ->config ->expects ($ this ->once ())->method ('getAppValue ' )
137+ ->with ('dav ' , 'exposeSystemAddressBook ' , 'no ' )->willReturn ('no ' );
132138 $ this ->userManager = $ this ->createMock (IUserManager::class);
133139 $ this ->groupManager = $ this ->createMock (IGroupManager::class);
134140 $ this ->principal = $ this ->getMockBuilder (Principal::class)
@@ -156,7 +162,7 @@ protected function setUp(): void {
156162
157163 $ this ->db = \OC ::$ server ->getDatabaseConnection ();
158164
159- $ this ->backend = new CardDavBackend ($ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher );
165+ $ this ->backend = new CardDavBackend ($ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config );
160166 // start every test with a empty cards_properties and cards table
161167 $ query = $ this ->db ->getQueryBuilder ();
162168 $ query ->delete ('cards_properties ' )->execute ();
@@ -246,7 +252,7 @@ public function testCardOperations() {
246252
247253 /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */
248254 $ backend = $ this ->getMockBuilder (CardDavBackend::class)
249- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
255+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
250256 ->setMethods (['updateProperties ' , 'purgeProperties ' ])->getMock ();
251257
252258 // create a new address book
@@ -318,7 +324,7 @@ public function testCardOperations() {
318324
319325 public function testMultiCard () {
320326 $ this ->backend = $ this ->getMockBuilder (CardDavBackend::class)
321- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
327+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
322328 ->setMethods (['updateProperties ' ])->getMock ();
323329
324330 // create a new address book
@@ -371,7 +377,7 @@ public function testMultiCard() {
371377
372378 public function testMultipleUIDOnDifferentAddressbooks () {
373379 $ this ->backend = $ this ->getMockBuilder (CardDavBackend::class)
374- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
380+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
375381 ->setMethods (['updateProperties ' ])->getMock ();
376382
377383 // create 2 new address books
@@ -414,7 +420,7 @@ public function testMultipleUIDDenied() {
414420
415421 public function testNoValidUID () {
416422 $ this ->backend = $ this ->getMockBuilder (CardDavBackend::class)
417- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
423+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
418424 ->setMethods (['updateProperties ' ])->getMock ();
419425
420426 // create a new address book
@@ -471,7 +477,7 @@ public function testDeleteWithoutCard() {
471477
472478 public function testSyncSupport () {
473479 $ this ->backend = $ this ->getMockBuilder (CardDavBackend::class)
474- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
480+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
475481 ->setMethods (['updateProperties ' ])->getMock ();
476482
477483 // create a new address book
@@ -537,7 +543,7 @@ public function testUpdateProperties() {
537543 $ cardId = 2 ;
538544
539545 $ backend = $ this ->getMockBuilder (CardDavBackend::class)
540- ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher ])
546+ ->setConstructorArgs ([$ this ->db , $ this ->principal , $ this ->userManager , $ this ->groupManager , $ this ->dispatcher , $ this ->legacyDispatcher , $ this -> config ])
541547 ->setMethods (['getCardId ' ])->getMock ();
542548
543549 $ backend ->expects ($ this ->any ())->method ('getCardId ' )->willReturn ($ cardId );
0 commit comments