mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test: update tests to new full sync
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
78d2541f10
commit
fc11eef4a1
1 changed files with 20 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace OCA\DAV\Tests\unit\CardDAV;
|
||||
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
|
|
@ -297,10 +298,26 @@ END:VCARD';
|
|||
}
|
||||
|
||||
public function testFullSyncWithOrphanElement(): void {
|
||||
$pendingCards = [];
|
||||
$this->backend->expects($this->exactly(0))
|
||||
->method('createCard');
|
||||
$this->backend->expects($this->exactly(1))
|
||||
->method('updateCard');
|
||||
->method('updateCard')
|
||||
->willReturnCallback(function ($id, $uri) use (&$pendingCards) {
|
||||
unset($pendingCards[$uri]);
|
||||
});
|
||||
$this->backend->expects($this->exactly(1))
|
||||
->method('markCardsAsPending')
|
||||
->willReturnCallback(function ($id) use (&$pendingCards) {
|
||||
$cards = array_values($this->backend->getCards($id));
|
||||
$uris = array_map(fn ($card) => $card['uri'], $cards);
|
||||
$pendingCards = array_combine($uris, $cards);
|
||||
});
|
||||
$this->backend->expects($this->exactly(1))
|
||||
->method('getPendingCards')
|
||||
->willReturnCallback(function ($id) use (&$pendingCards) {
|
||||
return array_values($pendingCards);
|
||||
});
|
||||
$this->backend->expects($this->exactly(1))
|
||||
->method('deleteCard');
|
||||
|
||||
|
|
@ -355,6 +372,7 @@ END:VCARD';
|
|||
['uri' => 'Database:bob.vcf'],
|
||||
]);
|
||||
|
||||
$this->service->markCardsAsPending(1);
|
||||
$token = $this->service->syncRemoteAddressBook(
|
||||
'',
|
||||
'system',
|
||||
|
|
@ -365,6 +383,7 @@ END:VCARD';
|
|||
'principals/system/system',
|
||||
[]
|
||||
)[0];
|
||||
$this->service->deletePendingCards(1);
|
||||
|
||||
$this->assertEquals('http://sabre.io/ns/sync/3', $token);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue