diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-13 11:55:06 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-14 12:21:42 +0100 |
commit | fbfca80f42ae0a7759bd71c3b2a38a15738af314 (patch) | |
tree | 5f8eaaacfa2426617c3db80e4e167ea7ba44801c | |
parent | a91954907b51debaa9cabc4ccb89bfa6ebcc9c94 (diff) | |
download | nextcloud-server-fbfca80f42ae0a7759bd71c3b2a38a15738af314.tar.gz nextcloud-server-fbfca80f42ae0a7759bd71c3b2a38a15738af314.zip |
Add test for ensureSystemAddressBookExists
-rw-r--r-- | apps/dav/tests/unit/carddav/syncservicetest.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/carddav/syncservicetest.php b/apps/dav/tests/unit/carddav/syncservicetest.php index 338ac2bbe1b..d66383461bb 100644 --- a/apps/dav/tests/unit/carddav/syncservicetest.php +++ b/apps/dav/tests/unit/carddav/syncservicetest.php @@ -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 |