]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add test for ensureSystemAddressBookExists
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 13 Jan 2016 10:55:06 +0000 (11:55 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Thu, 14 Jan 2016 11:21:42 +0000 (12:21 +0100)
apps/dav/tests/unit/carddav/syncservicetest.php

index 338ac2bbe1ba0b674e8f05d47296564ee95d3e60..d66383461bbe1e3fd707935a9692534c822542c7 100644 (file)
@@ -57,6 +57,17 @@ class SyncServiceTest extends TestCase {
                $this->assertEquals('sync-token-1', $return);
        }
 
+       public function testEnsureSystemAddressBookExists() {
+               /** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backend */
+               $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDAVBackend')->disableOriginalConstructor()->getMock();
+               $backend->expects($this->exactly(1))->method('createAddressBook');
+               $backend->expects($this->at(0))->method('getAddressBooksByUri')->willReturn(null);
+               $backend->expects($this->at(1))->method('getAddressBooksByUri')->willReturn([]);
+
+               $ss = new SyncService($backend);
+               $book = $ss->ensureSystemAddressBookExists('principals/users/adam', 'contacts', []);
+       }
+
        /**
         * @param int $createCount
         * @param int $updateCount