From 0b02a6d123b2014705998c94ddf3d460948d3eac Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 10 May 2016 17:26:44 -0700 Subject: initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import) --- .../sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php') diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php index ab7ac4e6a..3f96d3c5d 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php @@ -48,18 +48,36 @@ class Mock extends AbstractBackend { } - function updateAddressBook($addressBookId, array $mutations) { + /** + * Updates properties for an address book. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documenation for more info and examples. + * + * @param string $addressBookId + * @param \Sabre\DAV\PropPatch $propPatch + * @return void + */ + public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { foreach($this->addressBooks as &$book) { if ($book['id'] !== $addressBookId) continue; - foreach($mutations as $key=>$value) { - $book[$key] = $value; - } - return true; + $propPatch->handleRemaining(function($mutations) use (&$book) { + foreach($mutations as $key=>$value) { + $book[$key] = $value; + } + return true; + }); + } - return false; } -- cgit v1.2.3