aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php53
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]);
}