diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-04-30 21:36:05 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-05-03 13:56:02 +0000 |
commit | c41a916250322f4c9e5d72fb9a76357829b9b61b (patch) | |
tree | 2dac64ebb2f06d375056069e87db17d37ad7c1bc /apps/dav/tests/unit | |
parent | 47148762c8b08c8275c4d08502b229a7d1b6218b (diff) | |
download | nextcloud-server-c41a916250322f4c9e5d72fb9a76357829b9b61b.tar.gz nextcloud-server-c41a916250322f4c9e5d72fb9a76357829b9b61b.zip |
fix creating vcards with multiple string values
Internally it is valid to provide multiple values for a property as
plain string. An exampe is given in the PhpDoc of
AddressBookImpl::search().
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r-- | apps/dav/tests/unit/CardDAV/AddressBookImplTest.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 5b28e6b025b..5d037c1f38a 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -154,11 +154,20 @@ class AddressBookImplTest extends TestCase { ->setMethods(['vCard2Array', 'createUid', 'createEmptyVCard']) ->getMock(); + $expectedProperties = 0; + foreach ($properties as $data) { + if (is_string($data)) { + $expectedProperties++; + } else { + $expectedProperties += count($data); + } + } + $addressBookImpl->expects($this->once())->method('createUid') ->willReturn($uid); $addressBookImpl->expects($this->once())->method('createEmptyVCard') ->with($uid)->willReturn($this->vCard); - $this->vCard->expects($this->exactly(count($properties))) + $this->vCard->expects($this->exactly($expectedProperties)) ->method('createProperty'); $this->backend->expects($this->once())->method('createCard'); $this->backend->expects($this->never())->method('updateCard'); @@ -172,7 +181,8 @@ class AddressBookImplTest extends TestCase { public function dataTestCreate() { return [ [[]], - [['FN' => 'John Doe']] + [['FN' => 'John Doe']], + [['FN' => 'John Doe', 'EMAIL' => ['john@doe.cloud', 'john.doe@example.org']]], ]; } |