-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26865 from nextcloud/backport/26845/stable21
[stable21] fix creating vcards with multiple string values
- Loading branch information
Showing
2 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,11 +154,20 @@ public function testCreate($properties) { | |
->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 @@ public function testCreate($properties) { | |
public function dataTestCreate() { | ||
return [ | ||
[[]], | ||
[['FN' => 'John Doe']] | ||
[['FN' => 'John Doe']], | ||
[['FN' => 'John Doe', 'EMAIL' => ['[email protected]', '[email protected]']]], | ||
]; | ||
} | ||
|
||
|