diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-05-28 17:46:24 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-05-28 17:46:24 +0200 |
commit | 66effbfe0827fc61fff6d248797a894213ad20d6 (patch) | |
tree | 0fbb5ca644e1140e5b3b44b1adc874043790c388 /vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php | |
parent | ac4688eac087854bf8cb0c893d7a79052ad63a20 (diff) | |
download | volse-hubzilla-66effbfe0827fc61fff6d248797a894213ad20d6.tar.gz volse-hubzilla-66effbfe0827fc61fff6d248797a894213ad20d6.tar.bz2 volse-hubzilla-66effbfe0827fc61fff6d248797a894213ad20d6.zip |
upgrade to sabre32
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php index 4412e5531..d4dcc07dc 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php @@ -82,6 +82,46 @@ class Mock extends AbstractBackend { } /** + * Updates properties for a calendar. + * + * 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 documentation for more info and examples. + * + * @param mixed $calendarId + * @param \Sabre\DAV\PropPatch $propPatch + * @return void + */ + function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) { + + $propPatch->handleRemaining(function($props) use ($calendarId) { + + foreach ($this->calendars as $k => $calendar) { + + if ($calendar['id'] === $calendarId) { + foreach ($props as $propName => $propValue) { + if (is_null($propValue)) { + unset($this->calendars[$k][$propName]); + } else { + $this->calendars[$k][$propName] = $propValue; + } + } + return true; + + } + + } + + }); + + } + + /** * Delete a calendar and all it's objects * * @param string $calendarId @@ -139,18 +179,22 @@ class Mock extends AbstractBackend { * Returns information from a single calendar object, based on it's object * uri. * + * The object uri is only the basename, or filename and not a full path. + * * The returned array must have the same keys as getCalendarObjects. The * 'calendardata' object is required here though, while it's not required * for getCalendarObjects. * - * @param string $calendarId + * This method must return null if the object did not exist. + * + * @param mixed $calendarId * @param string $objectUri - * @return array + * @return array|null */ function getCalendarObject($calendarId, $objectUri) { if (!isset($this->calendarData[$calendarId][$objectUri])) { - throw new DAV\Exception\NotFound('Object could not be found'); + return null; } $object = $this->calendarData[$calendarId][$objectUri]; $object['calendarid'] = $calendarId; @@ -207,8 +251,7 @@ class Mock extends AbstractBackend { */ function deleteCalendarObject($calendarId, $objectUri) { - throw new Exception('Not implemented'); - + unset($this->calendarData[$calendarId][$objectUri]); } |