[Pkg-owncloud-commits] [php-sabredav] 06/148: Migrated HrefList and ResponseList

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit cce864844b72e48f36affdd28726ae1d7b71a1e9
Author: Evert Pot <me at evertpot.com>
Date:   Tue Dec 16 22:12:53 2014 -0500

    Migrated HrefList and ResponseList
---
 lib/CalDAV/Plugin.php                              |  10 +-
 lib/CalDAV/Schedule/Plugin.php                     |   2 +-
 lib/CardDAV/Plugin.php                             |  11 +-
 lib/DAV/Client.php                                 |  18 ++-
 lib/DAV/CorePlugin.php                             |   9 +-
 lib/DAV/Property/HrefList.php                      | 107 ----------------
 lib/DAV/Property/ResponseList.php                  | 134 ---------------------
 lib/DAV/XML/Property/Href.php                      |  11 ++
 lib/DAV/XMLUtil.php                                |  10 +-
 lib/DAVACL/Plugin.php                              |  58 ++++-----
 tests/Sabre/CalDAV/Backend/AbstractPDOTest.php     |  14 +--
 .../Sabre/CalDAV/CalendarHomeSubscriptionsTest.php |   6 +-
 tests/Sabre/CalDAV/JCalTransformTest.php           |  34 ++----
 tests/Sabre/CalDAV/PluginTest.php                  |  12 +-
 .../Sabre/CalDAV/Schedule/PluginPropertiesTest.php |   6 +-
 .../PluginPropertiesWithSharedCalendarTest.php     |   6 +-
 tests/Sabre/CardDAV/PluginTest.php                 |  23 ++--
 tests/Sabre/DAV/Property/HrefListTest.php          |  91 --------------
 tests/Sabre/DAV/Property/ResponseListTest.php      |  19 ---
 tests/Sabre/DAV/Sync/PluginTest.php                |  56 +++------
 tests/Sabre/DAV/SyncTokenPropertyTest.php          |   2 +-
 tests/Sabre/DAVACL/ExpandPropertiesTest.php        |   6 +-
 tests/Sabre/DAVACL/PluginPropertiesTest.php        |  10 +-
 tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php  |  40 +++---
 24 files changed, 158 insertions(+), 537 deletions(-)

diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php
index 22d96c7..35dec65 100644
--- a/lib/CalDAV/Plugin.php
+++ b/lib/CalDAV/Plugin.php
@@ -4,7 +4,7 @@ namespace Sabre\CalDAV;
 
 use DateTimeZone;
 use Sabre\DAV;
-use Sabre\DAV\Property\HrefList;
+use Sabre\DAV\Xml\Property\Href;
 use Sabre\DAVACL;
 use Sabre\VObject;
 use Sabre\HTTP;
@@ -331,7 +331,7 @@ class Plugin extends DAV\ServerPlugin {
             $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function() use ($principalUrl) {
 
                 $calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl) . '/';
-                return new DAV\Property\Href($calendarHomePath);
+                return new Href($calendarHomePath);
 
             });
             // The calendar-user-address-set property is basically mapped to
@@ -339,7 +339,7 @@ class Plugin extends DAV\ServerPlugin {
             $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-address-set', function() use ($node) {
                 $addresses = $node->getAlternateUriSet();
                 $addresses[] = $this->server->getBaseUri() . $node->getPrincipalUrl() . '/';
-                return new HrefList($addresses, false);
+                return new Href($addresses, false);
             });
             // For some reason somebody thought it was a good idea to add
             // another one of these properties. We're supporting it too.
@@ -382,8 +382,8 @@ class Plugin extends DAV\ServerPlugin {
 
                 }
 
-                $propFind->set($propRead, new HrefList($readList));
-                $propFind->set($propWrite, new HrefList($writeList));
+                $propFind->set($propRead, new Href($readList));
+                $propFind->set($propWrite, new Href($writeList));
 
             }
 
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 54d15ea..07f3d38 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -6,9 +6,9 @@ use
     DateTimeZone,
     Sabre\DAV\Server,
     Sabre\DAV\ServerPlugin,
-    Sabre\DAV\Property\Href,
     Sabre\DAV\PropFind,
     Sabre\DAV\INode,
+    Sabre\DAV\Xml\Property\Href,
     Sabre\HTTP\RequestInterface,
     Sabre\HTTP\ResponseInterface,
     Sabre\VObject,
diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php
index ab268aa..183ae22 100644
--- a/lib/CardDAV/Plugin.php
+++ b/lib/CardDAV/Plugin.php
@@ -12,6 +12,7 @@ use Sabre\HTTP;
 use Sabre\HTTP\RequestInterface;
 use Sabre\HTTP\ResponseInterface;
 
+use Sabre\DAV\Xml\Property\Href;
 
 /**
  * CardDAV plugin
@@ -88,7 +89,7 @@ class Plugin extends DAV\ServerPlugin {
         $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}addressbook-home-set';
         $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}supported-collation-set';
 
-        $server->propertyMap['{http://calendarserver.org/ns/}me-card'] = 'Sabre\\DAV\\Property\\Href';
+        $server->propertyMap['{http://calendarserver.org/ns/}me-card'] = 'Sabre\\DAV\\Xml\\Property\\Href';
 
         $this->server = $server;
 
@@ -158,11 +159,11 @@ class Plugin extends DAV\ServerPlugin {
             $path = $propFind->getPath();
 
             $propFind->handle('{' . self::NS_CARDDAV . '}addressbook-home-set', function() use ($path) {
-                return new DAV\Property\Href($this->getAddressBookHomeForPrincipal($path) . '/');
+                return new Href($this->getAddressBookHomeForPrincipal($path) . '/');
             });
 
             if ($this->directories) $propFind->handle('{' . self::NS_CARDDAV . '}directory-gateway', function() {
-                return new DAV\Property\HrefList($this->directories);
+                return new Href($this->directories);
             });
 
         }
@@ -190,7 +191,7 @@ class Plugin extends DAV\ServerPlugin {
                 $props = $this->server->getProperties($node->getOwner(), ['{http://sabredav.org/ns}vcard-url']);
                 if (isset($props['{http://sabredav.org/ns}vcard-url'])) {
 
-                    return new DAV\Property\Href(
+                    return new Href(
                         $props['{http://sabredav.org/ns}vcard-url']
                     );
 
@@ -220,7 +221,7 @@ class Plugin extends DAV\ServerPlugin {
 
         $propPatch->handle($meCard, function($value) use ($node) {
 
-            if ($value instanceof DAV\Property\IHref) {
+            if ($value instanceof Href) {
                 $value = $value->getHref();
                 $value = $this->server->calculateUri($value);
             } elseif (!is_null($value)) {
diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php
index 5c1b17d..4ec625a 100644
--- a/lib/DAV/Client.php
+++ b/lib/DAV/Client.php
@@ -420,20 +420,16 @@ class Client extends HTTP\Client {
      */
     function parseMultiStatus($body) {
 
-        try {
-            $dom = XMLUtil::loadDOMDocument($body);
-        } catch (Exception\BadRequest $e) {
-            throw new \InvalidArgumentException('The body passed to parseMultiStatus could not be parsed. Is it really xml?');
-        }
-
-        $responses = Property\ResponseList::unserialize(
-            $dom->documentElement,
-            $this->propertyMap
-        );
+        $xmlUtil = new XMLUtil();
+        $multistatus = $xmlUtil->parse($body)['value'];
 
         $result = [];
 
-        foreach($responses->getResponses() as $response) {
+        if (!$multistatus instanceof Xml\Response\MultiStatus) {
+            throw new \InvalidArgumentException('Xml could not be parsed into a {DAV:}multistatus document');
+        }
+
+        foreach($multistatus->getResponses() as $response) {
 
             $result[$response->getHref()] = $response->getResponseProperties();
 
diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php
index dd27dda..e3cf9ac 100644
--- a/lib/DAV/CorePlugin.php
+++ b/lib/DAV/CorePlugin.php
@@ -49,11 +49,6 @@ class CorePlugin extends ServerPlugin {
         $server->on('propFind',         [$this, 'propFindNode'], 120);
         $server->on('propFind',         [$this, 'propFindLate'], 200);
 
-        $server->xml->elementMap = [
-            '{DAV:}propfind' => 'Sabre\\DAV\\XML\\Request\\PropFind',
-            '{DAV:}prop'     => 'Sabre\\XML\\Element\\Elements',
-        ];
-
     }
 
     /**
@@ -879,7 +874,7 @@ class CorePlugin extends ServerPlugin {
             if ($val && is_scalar($val)) {
                 return $val;
             }
-            if ($val && $val instanceof Property\IHref) {
+            if ($val && $val instanceof Xml\Property\Href) {
                 return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
             }
 
@@ -897,7 +892,7 @@ class CorePlugin extends ServerPlugin {
                 $val = $result['{DAV:}sync-token'];
                 if (is_scalar($val)) {
                     return $val;
-                } elseif ($val instanceof Property\IHref) {
+                } elseif ($val instanceof Xml\Property\Href) {
                     return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
                 }
             }
diff --git a/lib/DAV/Property/HrefList.php b/lib/DAV/Property/HrefList.php
deleted file mode 100644
index a35d292..0000000
--- a/lib/DAV/Property/HrefList.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-namespace Sabre\DAV\Property;
-
-use Sabre\DAV;
-use Sabre\HTTP\URLUtil;
-
-/**
- * HrefList property
- *
- * This property contains multiple {DAV:}href elements, each containing a url.
- *
- * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
- * @author Evert Pot (http://evertpot.com/)
- * @license http://sabre.io/license/ Modified BSD License
- */
-class HrefList extends DAV\Property {
-
-    /**
-     * hrefs
-     *
-     * @var array
-     */
-    private $hrefs;
-
-    /**
-     * Automatically prefix the url with the server base directory
-     *
-     * @var bool
-     */
-    private $autoPrefix = true;
-
-    /**
-     * __construct
-     *
-     * @param array $hrefs
-     * @param bool $autoPrefix
-     */
-    function __construct(array $hrefs, $autoPrefix = true) {
-
-        $this->hrefs = $hrefs;
-        $this->autoPrefix = $autoPrefix;
-
-    }
-
-    /**
-     * Returns the uris
-     *
-     * @return array
-     */
-    function getHrefs() {
-
-        return $this->hrefs;
-
-    }
-
-    /**
-     * Serializes this property.
-     *
-     * It will additionally prepend the href property with the server's base uri.
-     *
-     * @param DAV\Server $server
-     * @param \DOMElement $dom
-     * @return void
-     */
-    function serialize(DAV\Server $server,\DOMElement $dom) {
-
-        $prefix = $server->xmlNamespaces['DAV:'];
-
-        foreach($this->hrefs as $href) {
-
-            $elem = $dom->ownerDocument->createElement($prefix . ':href');
-            if ($this->autoPrefix) {
-                $value = $server->getBaseUri() . URLUtil::encodePath($href);
-            } else {
-                $value = $href;
-            }
-            $elem->appendChild($dom->ownerDocument->createTextNode($value));
-
-            $dom->appendChild($elem);
-        }
-
-    }
-
-    /**
-     * Unserializes this property from a DOM Element
-     *
-     * This method returns an instance of this class.
-     * It will only decode {DAV:}href values.
-     *
-     * @param \DOMElement $dom
-     * @param array $propertyMap
-     * @return DAV\Property\HrefList
-     */
-    static function unserialize(\DOMElement $dom, array $propertyMap) {
-
-        $hrefs = [];
-        foreach($dom->childNodes as $child) {
-            if (DAV\XMLUtil::toClarkNotation($child)==='{DAV:}href') {
-                $hrefs[] = $child->textContent;
-            }
-        }
-        return new self($hrefs, false);
-
-    }
-
-}
diff --git a/lib/DAV/Property/ResponseList.php b/lib/DAV/Property/ResponseList.php
deleted file mode 100644
index ceef79c..0000000
--- a/lib/DAV/Property/ResponseList.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-
-namespace Sabre\DAV\Property;
-
-use Sabre\DAV;
-
-/**
- * ResponseList property
- *
- * This class represents multiple {DAV:}response XML elements.
- * This is used by the Server class to encode items within a multistatus
- * response.
- *
- * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
- * @author Evert Pot (http://evertpot.com/)
- * @license http://sabre.io/license/ Modified BSD License
- */
-class ResponseList extends DAV\Property {
-
-    /**
-     * Response objects.
-     *
-     * @var array
-     */
-    private $responses;
-
-    /**
-     * The only valid argument is a list of Sabre\DAV\Property\Response
-     * objects.
-     *
-     * @param array $responses;
-     */
-    function __construct($responses) {
-
-        foreach($responses as $response) {
-            if (!($response instanceof Response)) {
-                throw new \InvalidArgumentException('You must pass an array of Sabre\DAV\Property\Response objects');
-            }
-        }
-        $this->responses = $responses;
-
-    }
-
-    /**
-     * Returns the list of Response properties.
-     *
-     * @return Response[]
-     */
-    function getResponses() {
-
-        return $this->responses;
-
-    }
-
-    /**
-     * serialize
-     *
-     * @param DAV\Server $server
-     * @param \DOMElement $dom
-     * @return void
-     */
-    function serialize(DAV\Server $server,\DOMElement $dom) {
-
-        foreach($this->responses as $response) {
-            $response->serialize($server, $dom);
-        }
-
-    }
-
-    /**
-     * Unserializes the property.
-     *
-     * This static method should return a an instance of this object.
-     *
-     * @param \DOMElement $prop
-     * @param array $propertyMap
-     * @return DAV\IProperty
-     */
-    static function unserialize(\DOMElement $prop, array $propertyMap) {
-
-        $xpath = new \DOMXPath( $prop->ownerDocument );
-        $xpath->registerNamespace('d','urn:DAV');
-
-        // Finding the 'response' element
-        $xResponses = $xpath->evaluate(
-            'd:response',
-            $prop
-        );
-
-        $result = [];
-
-        for($jj=0; $jj < $xResponses->length; $jj++) {
-
-            $xResponse = $xResponses->item($jj);
-
-            // Parsing 'href'
-            $href = Href::unserialize($xResponse, $propertyMap);
-
-            $properties = [];
-
-            // Parsing 'status' in 'd:response'
-            $responseStatus = $xpath->evaluate('string(d:status)', $xResponse);
-            if ($responseStatus) {
-                list(, $responseStatus,) = explode(' ', $responseStatus, 3);
-            }
-
-
-            // Parsing 'propstat'
-            $xPropstat = $xpath->query('d:propstat', $xResponse);
-
-            for($ii=0; $ii < $xPropstat->length; $ii++) {
-
-                // Parsing 'status'
-                $status = $xpath->evaluate('string(d:status)', $xPropstat->item($ii));
-
-                list(,$statusCode,) = explode(' ', $status, 3);
-
-                $usedPropertyMap = $statusCode == '200' ? $propertyMap : [];
-
-                // Parsing 'prop'
-                $properties[$statusCode] = DAV\XMLUtil::parseProperties($xPropstat->item($ii), $usedPropertyMap);
-
-            }
-
-            $result[] = new Response($href->getHref(), $properties, $responseStatus?$responseStatus:null);
-
-        }
-
-        return new self($result);
-
-    }
-
-
-}
diff --git a/lib/DAV/XML/Property/Href.php b/lib/DAV/XML/Property/Href.php
index e7776b6..9ce2e50 100644
--- a/lib/DAV/XML/Property/Href.php
+++ b/lib/DAV/XML/Property/Href.php
@@ -60,6 +60,17 @@ class Href implements Element {
     }
 
     /**
+     * Returns the first Href.
+     *
+     * @return string
+     */
+    public function getHref() {
+
+        return $this->hrefs[0];
+
+    }
+
+    /**
      * Returns the hrefs as an array
      *
      * @return array
diff --git a/lib/DAV/XMLUtil.php b/lib/DAV/XMLUtil.php
index 49fa202..3d4c212 100644
--- a/lib/DAV/XMLUtil.php
+++ b/lib/DAV/XMLUtil.php
@@ -18,7 +18,15 @@ class XMLUtil {
      * For instance, this list may contain an entry `{DAV:}propfind` that would
      * be mapped to Sabre\DAV\XML\Request\PropFind
      */
-    public $elementMap = [];
+    public $elementMap = [
+        '{DAV:}multistatus' => 'Sabre\\DAV\\Xml\\Response\\MultiStatus',
+        '{DAV:}response'    => 'Sabre\\DAV\\Xml\\Element\\Response',
+        '{DAV:}propstat'    => 'Sabre\\Xml\\Element\\KeyValue',
+        '{DAV:}prop'        => 'Sabre\\Xml\\Element\\KeyValue',
+
+        // Requests
+        '{DAV:}propfind' => 'Sabre\\DAV\\Xml\\Request\\PropFind',
+    ];
 
     /**
      * This is a default list of namespaces.
diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index f1bd5a7..8194f01 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -708,7 +708,7 @@ class Plugin extends DAV\ServerPlugin {
 
         // Mapping the group-member-set property to the HrefList property
         // class.
-        $server->propertyMap['{DAV:}group-member-set'] = 'Sabre\\DAV\\Property\\HrefList';
+        $server->propertyMap['{DAV:}group-member-set'] = 'Sabre\\DAV\\Xml\\Property\\Href';
 
     }
 
@@ -863,24 +863,24 @@ class Plugin extends DAV\ServerPlugin {
         if ($node instanceof IPrincipal) {
 
             $propFind->handle('{DAV:}alternate-URI-set', function() use ($node) {
-                return new DAV\Property\HrefList($node->getAlternateUriSet());
+                return new DAV\Xml\Property\Href($node->getAlternateUriSet());
             });
             $propFind->handle('{DAV:}principal-URL', function() use ($node) {
-                return new DAV\Property\Href($node->getPrincipalUrl() . '/');
+                return new DAV\Xml\Property\Href($node->getPrincipalUrl() . '/');
             });
             $propFind->handle('{DAV:}group-member-set', function() use ($node) {
                 $members = $node->getGroupMemberSet();
                 foreach($members as $k=>$member) {
                     $members[$k] = rtrim($member,'/') . '/';
                 }
-                return new DAV\Property\HrefList($members);
+                return new DAV\Xml\Property\Href($members);
             });
             $propFind->handle('{DAV:}group-membership', function() use ($node) {
                 $members = $node->getGroupMembership();
                 foreach($members as $k=>$member) {
                     $members[$k] = rtrim($member,'/') . '/';
                 }
-                return new DAV\Property\HrefList($members);
+                return new DAV\Xml\Property\Href($members);
             });
             $propFind->handle('{DAV:}displayname', [$node, 'getDisplayName']);
 
@@ -891,7 +891,7 @@ class Plugin extends DAV\ServerPlugin {
             $val = $this->principalCollectionSet;
             // Ensuring all collections end with a slash
             foreach($val as $k=>$v) $val[$k] = $v . '/';
-            return new DAV\Property\HrefList($val);
+            return new DAV\Xml\Property\Href($val);
 
         });
         $propFind->handle('{DAV:}current-user-principal', function() {
@@ -951,7 +951,7 @@ class Plugin extends DAV\ServerPlugin {
         $propPatch->handle('{DAV:}group-member-set', function($value) use ($path) {
             if (is_null($value)) {
                 $memberSet = [];
-            } elseif ($value instanceof DAV\Property\HrefList) {
+            } elseif ($value instanceof DAV\Xml\Property\Href) {
                 $memberSet = array_map(
                     [$this->server,'calculateUri'],
                     $value->getHrefs()
@@ -1112,23 +1112,11 @@ class Plugin extends DAV\ServerPlugin {
 
         $result = $this->expandProperties($requestUri,$requestedProperties,$depth);
 
-        $dom = new \DOMDocument('1.0','utf-8');
-        $dom->formatOutput = true;
-        $multiStatus = $dom->createElement('d:multistatus');
-        $dom->appendChild($multiStatus);
-
-        // Adding in default namespaces
-        foreach($this->server->xmlNamespaces as $namespace=>$prefix) {
-
-            $multiStatus->setAttribute('xmlns:' . $prefix,$namespace);
-
-        }
-
-        foreach($result as $response) {
-            $response->serialize($this->server, $multiStatus);
-        }
-
-        $xml = $dom->saveXML();
+        $xml = $this->server->xml->write([
+            '{DAV:}multistatus' => new DAV\Xml\Response\MultiStatus(
+                $result
+            )
+        ]);
         $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
         $this->server->httpResponse->setStatus(207);
         $this->server->httpResponse->setBody($xml);
@@ -1197,20 +1185,26 @@ class Plugin extends DAV\ServerPlugin {
                 // and it contains an href element.
                 if (!array_key_exists($propertyName,$node[200])) continue;
 
-                if ($node[200][$propertyName] instanceof DAV\Property\IHref) {
-                    $hrefs = [$node[200][$propertyName]->getHref()];
-                } elseif ($node[200][$propertyName] instanceof DAV\Property\HrefList) {
-                    $hrefs = $node[200][$propertyName]->getHrefs();
+                if (!$node[200][$propertyName] instanceof DAV\Xml\Property\Href) {
+                    continue;
                 }
 
+                $childHrefs = $node[200][$propertyName]->getHrefs();
                 $childProps = [];
-                foreach($hrefs as $href) {
-                    $childProps = array_merge($childProps, $this->expandProperties($href, $childRequestedProperties, 0));
+
+                foreach($childHrefs as $href) {
+                    // Gathering the result of the children
+                    $childProps[] = [
+                        'name' => '{DAV:}response',
+                        'value' => $this->expandProperties($href, $childRequestedProperties, 0)[0]
+                    ];
                 }
-                $node[200][$propertyName] = new DAV\Property\ResponseList($childProps);
+
+                // Replacing the property with its expannded form.
+                $node[200][$propertyName] = $childProps;
 
             }
-            $result[] = new DAV\Property\Response($node['href'], $node);
+            $result[] = new DAV\Xml\Element\Response($node['href'], $node);
 
         }
 
diff --git a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
index 27eb901..896b428 100644
--- a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
+++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
@@ -697,7 +697,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
     function testCreateSubscriptions() {
 
         $props = [
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
             '{DAV:}displayname' => 'cal',
             '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
             '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
@@ -742,7 +742,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
     function testUpdateSubscriptions() {
 
         $props = [
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
             '{DAV:}displayname' => 'cal',
             '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
             '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
@@ -756,7 +756,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
 
         $newProps = [
             '{DAV:}displayname' => 'new displayname',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal2.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
         ];
 
         $propPatch = new DAV\PropPatch($newProps);
@@ -785,7 +785,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
     function testUpdateSubscriptionsFail() {
 
         $props = [
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
             '{DAV:}displayname' => 'cal',
             '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
             '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
@@ -799,7 +799,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
 
         $propPatch = new DAV\PropPatch([
             '{DAV:}displayname' => 'new displayname',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal2.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
             '{DAV:}unknown' => 'foo',
         ]);
 
@@ -817,7 +817,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
     function testDeleteSubscriptions() {
 
         $props = [
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
             '{DAV:}displayname' => 'cal',
             '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
             '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
@@ -831,7 +831,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
 
         $newProps = [
             '{DAV:}displayname' => 'new displayname',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/cal2.ics', false),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
         ];
 
         $backend->deleteSubscription(1);
diff --git a/tests/Sabre/CalDAV/CalendarHomeSubscriptionsTest.php b/tests/Sabre/CalDAV/CalendarHomeSubscriptionsTest.php
index 7aa450f..7ebc331 100644
--- a/tests/Sabre/CalDAV/CalendarHomeSubscriptionsTest.php
+++ b/tests/Sabre/CalDAV/CalendarHomeSubscriptionsTest.php
@@ -12,7 +12,7 @@ class CalendarHomeSubscriptionsTest extends \PHPUnit_Framework_TestCase {
 
         $props = [
             '{DAV:}displayname' => 'baz',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/test.ics'),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/test.ics'),
         ];
         $principal = [
             'uri' => 'principals/user1'
@@ -52,7 +52,7 @@ class CalendarHomeSubscriptionsTest extends \PHPUnit_Framework_TestCase {
 
         $props = [
             '{DAV:}displayname' => 'baz',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/test2.ics'),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/test2.ics'),
         ];
         $instance->createExtendedCollection('sub2', $rt, $props);
 
@@ -76,7 +76,7 @@ class CalendarHomeSubscriptionsTest extends \PHPUnit_Framework_TestCase {
 
         $props = [
             '{DAV:}displayname' => 'baz',
-            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Property\Href('http://example.org/test2.ics'),
+            '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/test2.ics'),
         ];
         $uC->createExtendedCollection('sub2', $rt, $props);
 
diff --git a/tests/Sabre/CalDAV/JCalTransformTest.php b/tests/Sabre/CalDAV/JCalTransformTest.php
index abed423..344bad9 100644
--- a/tests/Sabre/CalDAV/JCalTransformTest.php
+++ b/tests/Sabre/CalDAV/JCalTransformTest.php
@@ -77,15 +77,11 @@ XML;
 
         $this->assertEquals(207, $response->getStatus(), 'Full rsponse: ' . $response->getBodyAsString());
 
-        $body = $response->getBodyAsString();
-
-        // Getting from the xml body to the actual returned data is
-        // unfortunately very convoluted.
-        $responses = \Sabre\DAV\Property\ResponseList::unserialize(
-            \Sabre\DAV\XMLUtil::loadDOMDocument($body)->firstChild
-        , $this->server->propertyMap);
+        $multiStatus = $this->server->xml->parse(
+            $response->getBodyAsString()
+        )['value'];
 
-        $responses = $responses->getResponses();
+        $responses = $multiStatus->getResponses();
         $this->assertEquals(1, count($responses));
 
         $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
@@ -134,15 +130,12 @@ XML;
 
         $this->assertEquals(207, $response->getStatus(), "Invalid response code. Full body: " . $response->getBodyAsString());
 
-        $body = $response->getBodyAsString();
+        $multiStatus = $this->server->xml->parse(
+            $response->getBodyAsString()
+        )['value'];
 
-        // Getting from the xml body to the actual returned data is
-        // unfortunately very convoluted.
-        $responses = \Sabre\DAV\Property\ResponseList::unserialize(
-            \Sabre\DAV\XMLUtil::loadDOMDocument($body)->firstChild
-        , $this->server->propertyMap);
+        $responses = $multiStatus->getResponses();
 
-        $responses = $responses->getResponses();
         $this->assertEquals(1, count($responses));
 
         $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
@@ -190,15 +183,12 @@ XML;
 
         $this->assertEquals(207, $response->getStatus(), "Invalid response code. Full body: " . $response->getBodyAsString());
 
-        $body = $response->getBodyAsString();
+        $multiStatus = $this->server->xml->parse(
+            $response->getBodyAsString()
+        )['value'];
 
-        // Getting from the xml body to the actual returned data is
-        // unfortunately very convoluted.
-        $responses = \Sabre\DAV\Property\ResponseList::unserialize(
-            \Sabre\DAV\XMLUtil::loadDOMDocument($body)->firstChild
-        , $this->server->propertyMap);
+        $responses = $multiStatus->getResponses();
 
-        $responses = $responses->getResponses();
         $this->assertEquals(1, count($responses));
 
         $response = $responses[0]->getResponseProperties()[200]["{urn:ietf:params:xml:ns:caldav}calendar-data"];
diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php
index 40f6c5c..a6e9291 100644
--- a/tests/Sabre/CalDAV/PluginTest.php
+++ b/tests/Sabre/CalDAV/PluginTest.php
@@ -447,17 +447,17 @@ END:VCALENDAR';
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-home-set',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-home-set'];
-        $this->assertTrue($prop instanceof DAV\Property\Href);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
         $this->assertEquals('calendars/user1/',$prop->getHref());
 
         $this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-read-for', $props[0][200]);
         $prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-read-for'];
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $prop);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
         $this->assertEquals(array('principals/admin'), $prop->getHrefs());
 
         $this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-write-for', $props[0][200]);
         $prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-write-for'];
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $prop);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
         $this->assertEquals(array('principals/admin'), $prop->getHrefs());
 
 
@@ -475,7 +475,7 @@ END:VCALENDAR';
 
         $prop = $props[0][200]['{DAV:}supported-report-set'];
 
-        $this->assertInstanceOf('\\Sabre\\DAV\\Property\\SupportedReportSet', $prop);
+        $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
         $value = array(
             '{DAV:}expand-property',
             '{DAV:}principal-property-search',
@@ -500,7 +500,7 @@ END:VCALENDAR';
 
         $prop = $props[0][200]['{DAV:}supported-report-set'];
 
-        $this->assertTrue($prop instanceof \Sabre\DAV\Property\SupportedReportSet);
+        $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
         $value = array(
             '{urn:ietf:params:xml:ns:caldav}calendar-multiget',
             '{urn:ietf:params:xml:ns:caldav}calendar-query',
@@ -527,7 +527,7 @@ END:VCALENDAR';
 
         $prop = $props[0][200]['{DAV:}supported-report-set'];
 
-        $this->assertTrue($prop instanceof \Sabre\DAV\Property\SupportedReportSet);
+        $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
         $value = array(
             '{DAV:}sync-collection',
             '{DAV:}expand-property',
diff --git a/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php b/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php
index 2a50763..b9a2e6c 100644
--- a/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php
+++ b/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php
@@ -39,17 +39,17 @@ class PluginPropertiesTest extends \Sabre\DAVServerTest {
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL'];
-        $this->assertTrue($prop instanceof DAV\Property\Href);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals('calendars/user1/outbox/',$prop->getHref());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL'];
-        $this->assertTrue($prop instanceof DAV\Property\Href);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals('calendars/user1/inbox/',$prop->getHref());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-address-set',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set'];
-        $this->assertTrue($prop instanceof DAV\Property\HrefList);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals(array('mailto:user1.sabredav at sabredav.org','/principals/user1/'),$prop->getHrefs());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-type',$props[0][200]);
diff --git a/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php b/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php
index 81313c8..6cdb65c 100644
--- a/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php
+++ b/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php
@@ -49,17 +49,17 @@ class PluginPropertiesWithSharedCalendarTest extends \Sabre\DAVServerTest {
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL'];
-        $this->assertTrue($prop instanceof DAV\Property\Href);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals('calendars/user1/outbox/',$prop->getHref());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL'];
-        $this->assertTrue($prop instanceof DAV\Property\Href);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals('calendars/user1/inbox/',$prop->getHref());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-address-set',$props[0][200]);
         $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set'];
-        $this->assertTrue($prop instanceof DAV\Property\HrefList);
+        $this->assertTrue($prop instanceof DAV\Xml\Property\Href);
         $this->assertEquals(array('mailto:user1.sabredav at sabredav.org','/principals/user1/'),$prop->getHrefs());
 
         $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-type',$props[0][200]);
diff --git a/tests/Sabre/CardDAV/PluginTest.php b/tests/Sabre/CardDAV/PluginTest.php
index aadb04c..8928bb9 100644
--- a/tests/Sabre/CardDAV/PluginTest.php
+++ b/tests/Sabre/CardDAV/PluginTest.php
@@ -3,6 +3,7 @@
 namespace Sabre\CardDAV;
 
 use Sabre\DAV;
+use Sabre\DAV\Xml\Property\Href;
 
 class PluginTest extends AbstractPluginTest {
 
@@ -53,7 +54,7 @@ class PluginTest extends AbstractPluginTest {
         $this->assertEquals(
             array(
                 '{http://calendarserver.org/ns/}me-card' =>
-                    new DAV\Property\Href('addressbooks/user1/book1/vcard1.vcf')
+                    new Href('addressbooks/user1/book1/vcard1.vcf')
             ),
             $result
         );
@@ -111,14 +112,14 @@ class PluginTest extends AbstractPluginTest {
 
     function testUpdatePropertiesMeCard() {
 
-        $result = $this->server->updateProperties('addressbooks/user1', array(
-            '{http://calendarserver.org/ns/}me-card' => new DAV\Property\Href('/addressbooks/user1/book1/vcard2',true),
-        ));
+        $result = $this->server->updateProperties('addressbooks/user1', [
+            '{http://calendarserver.org/ns/}me-card' => new Href('/addressbooks/user1/book1/vcard2',true),
+        ]);
 
         $this->assertEquals(
-            array(
+            [
                 '{http://calendarserver.org/ns/}me-card' => 200,
-            ),
+            ],
             $result
         );
 
@@ -126,14 +127,14 @@ class PluginTest extends AbstractPluginTest {
 
     function testUpdatePropertiesMeCardBadValue() {
 
-        $result = $this->server->updateProperties('addressbooks/user1', array(
-            '{http://calendarserver.org/ns/}me-card' => new DAV\Property\HrefList(array()),
-        ));
+        $result = $this->server->updateProperties('addressbooks/user1', [
+            '{http://calendarserver.org/ns/}me-card' => [],
+        ]);
 
         $this->assertEquals(
-            array(
+            [
                 '{http://calendarserver.org/ns/}me-card' => 400,
-            ),
+            ],
             $result
         );
 
diff --git a/tests/Sabre/DAV/Property/HrefListTest.php b/tests/Sabre/DAV/Property/HrefListTest.php
deleted file mode 100644
index 949a377..0000000
--- a/tests/Sabre/DAV/Property/HrefListTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-
-namespace Sabre\DAV\Property;
-use Sabre\DAV;
-
-class HrefListTest extends \PHPUnit_Framework_TestCase {
-
-    function testConstruct() {
-
-        $href = new HrefList(array('foo','bar'));
-        $this->assertEquals(array('foo','bar'),$href->getHrefs());
-
-    }
-
-    function testSerialize() {
-
-        $href = new HrefList(array('foo','bar'));
-        $this->assertEquals(array('foo','bar'),$href->getHrefs());
-
-        $doc = new \DOMDocument();
-        $root = $doc->createElement('d:anything');
-        $root->setAttribute('xmlns:d','DAV:');
-
-        $doc->appendChild($root);
-        $server = new DAV\Server();
-        $server->setBaseUri('/bla/');
-
-        $href->serialize($server, $root);
-
-        $xml = $doc->saveXML();
-
-        $this->assertEquals(
-'<?xml version="1.0"?>
-<d:anything xmlns:d="DAV:"><d:href>/bla/foo</d:href><d:href>/bla/bar</d:href></d:anything>
-', $xml);
-
-    }
-
-    function testSerializeNoPrefix() {
-
-        $href = new HrefList(array('foo','bar'), false);
-        $this->assertEquals(array('foo','bar'),$href->getHrefs());
-
-        $doc = new \DOMDocument();
-        $root = $doc->createElement('d:anything');
-        $root->setAttribute('xmlns:d','DAV:');
-
-        $doc->appendChild($root);
-        $server = new DAV\Server();
-        $server->setBaseUri('/bla/');
-
-        $href->serialize($server, $root);
-
-        $xml = $doc->saveXML();
-
-        $this->assertEquals(
-'<?xml version="1.0"?>
-<d:anything xmlns:d="DAV:"><d:href>foo</d:href><d:href>bar</d:href></d:anything>
-', $xml);
-
-    }
-
-    function testUnserialize() {
-
-        $xml = '<?xml version="1.0"?>
-<d:anything xmlns:d="urn:DAV"><d:href>/bla/foo</d:href><d:href>/bla/bar</d:href></d:anything>
-';
-
-        $dom = new \DOMDocument();
-        $dom->loadXML($xml);
-
-        $href = HrefList::unserialize($dom->firstChild, array());
-        $this->assertEquals(array('/bla/foo','/bla/bar'),$href->getHrefs());
-
-    }
-
-    function testUnserializeIncompatible() {
-
-        $xml = '<?xml version="1.0"?>
-<d:anything xmlns:d="urn:DAV"><d:href2>/bla/foo</d:href2></d:anything>
-';
-
-        $dom = new \DOMDocument();
-        $dom->loadXML($xml);
-
-        $href = HrefList::unserialize($dom->firstChild, array());
-        $this->assertEquals(array(), $href->getHrefs());
-
-    }
-
-}
diff --git a/tests/Sabre/DAV/Property/ResponseListTest.php b/tests/Sabre/DAV/Property/ResponseListTest.php
deleted file mode 100644
index d13066b..0000000
--- a/tests/Sabre/DAV/Property/ResponseListTest.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-namespace Sabre\DAV\Property;
-
-class ResponseListTest extends \PHPUnit_Framework_TestCase {
-
-    /**
-     * This was the only part not yet covered by other tests, so I'm going to
-     * be lazy and (for now) only test this case.
-     *
-     * @expectedException InvalidArgumentException
-     */
-    public function testInvalidArg() {
-
-        $response = new ResponseList(array(1,2));
-
-    }
-
-}
diff --git a/tests/Sabre/DAV/Sync/PluginTest.php b/tests/Sabre/DAV/Sync/PluginTest.php
index 863f692..43e32f6 100644
--- a/tests/Sabre/DAV/Sync/PluginTest.php
+++ b/tests/Sabre/DAV/Sync/PluginTest.php
@@ -92,22 +92,15 @@ BLA;
 
         $this->assertEquals(207, $response->status, 'Full response body:' . $response->body);
 
-        $dom = DAV\XMLUtil::loadDOMDocument(
-            $response->body
-        );
+        $multiStatus = $this->server->xml->parse($response->getBodyAsString())['value'];
 
         // Checking the sync-token
         $this->assertEquals(
             'http://sabre.io/ns/sync/1',
-            $dom->getElementsByTagNameNS('urn:DAV', 'sync-token')->item(0)->nodeValue
-        );
-
-        $responses = DAV\Property\ResponseList::unserialize(
-            $dom->documentElement,
-            []
+            $multiStatus->getSyncToken()
         );
 
-        $responses = $responses->getResponses();
+        $responses = $multiStatus->getResponses();
         $this->assertEquals(2, count($responses), 'We expected exactly 2 {DAV:}response');
 
         $response = $responses[0];
@@ -162,22 +155,15 @@ BLA;
 
         $this->assertEquals(207, $response->status, 'Full response body:' . $response->body);
 
-        $dom = DAV\XMLUtil::loadDOMDocument(
-            $response->body
-        );
+        $multiStatus = $this->server->xml->parse($response->getBodyAsString())['value'];
 
         // Checking the sync-token
         $this->assertEquals(
             'http://sabre.io/ns/sync/2',
-            $dom->getElementsByTagNameNS('urn:DAV', 'sync-token')->item(0)->nodeValue
-        );
-
-        $responses = DAV\Property\ResponseList::unserialize(
-            $dom->documentElement,
-            []
+            $multiStatus->getSyncToken()
         );
 
-        $responses = $responses->getResponses();
+        $responses = $multiStatus->getResponses();
         $this->assertEquals(2, count($responses), 'We expected exactly 2 {DAV:}response');
 
         $response = $responses[0];
@@ -229,22 +215,17 @@ BLA;
 
         $this->assertEquals(207, $response->status, 'Full response body:' . $response->body);
 
-        $dom = DAV\XMLUtil::loadDOMDocument(
-            $response->body
-        );
+        $multiStatus = $this->server->xml->parse(
+            $response->getBodyAsString()
+        )['value'];
 
         // Checking the sync-token
         $this->assertEquals(
             'http://sabre.io/ns/sync/2',
-            $dom->getElementsByTagNameNS('urn:DAV', 'sync-token')->item(0)->nodeValue
-        );
-
-        $responses = DAV\Property\ResponseList::unserialize(
-            $dom->documentElement,
-            []
+            $multiStatus->getSyncToken()
         );
 
-        $responses = $responses->getResponses();
+        $responses = $multiStatus->getResponses();
         $this->assertEquals(1, count($responses), 'We expected exactly 1 {DAV:}response');
 
         $response = $responses[0];
@@ -285,22 +266,17 @@ BLA;
 
         $this->assertEquals(207, $response->status, 'Full response body:' . $response->body);
 
-        $dom = DAV\XMLUtil::loadDOMDocument(
-            $response->body
-        );
+        $multiStatus = $this->server->xml->parse(
+            $response->getBodyAsString()
+        )['value'];
 
         // Checking the sync-token
         $this->assertEquals(
             'http://sabre.io/ns/sync/2',
-            $dom->getElementsByTagNameNS('urn:DAV', 'sync-token')->item(0)->nodeValue
-        );
-
-        $responses = DAV\Property\ResponseList::unserialize(
-            $dom->documentElement,
-            []
+            $multiStatus->getSyncToken()
         );
 
-        $responses = $responses->getResponses();
+        $responses = $multiStatus->getResponses();
         $this->assertEquals(2, count($responses), 'We expected exactly 2 {DAV:}response');
 
         $response = $responses[0];
diff --git a/tests/Sabre/DAV/SyncTokenPropertyTest.php b/tests/Sabre/DAV/SyncTokenPropertyTest.php
index b6df027..b509508 100644
--- a/tests/Sabre/DAV/SyncTokenPropertyTest.php
+++ b/tests/Sabre/DAV/SyncTokenPropertyTest.php
@@ -91,7 +91,7 @@ class SyncTokenPropertyTest extends \Sabre\DAVServerTest {
             ],
             [
                 '{DAV:}sync-token',
-                new Property\Href(Sync\Plugin::SYNCTOKEN_PREFIX . "hello", false)
+                new Xml\Property\Href(Sync\Plugin::SYNCTOKEN_PREFIX . "hello", false)
             ]
         ];
 
diff --git a/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/tests/Sabre/DAVACL/ExpandPropertiesTest.php
index 1955394..5e99f2e 100644
--- a/tests/Sabre/DAVACL/ExpandPropertiesTest.php
+++ b/tests/Sabre/DAVACL/ExpandPropertiesTest.php
@@ -14,12 +14,12 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
         $tree = array(
             new DAV\Mock\PropertiesCollection('node1', [], array(
                 '{http://sabredav.org/ns}simple' => 'foo',
-                '{http://sabredav.org/ns}href'   => new DAV\Property\Href('node2'),
+                '{http://sabredav.org/ns}href'   => new DAV\Xml\Property\Href('node2'),
                 '{DAV:}displayname'     => 'Node 1',
             )),
             new DAV\Mock\PropertiesCollection('node2', [], array(
                 '{http://sabredav.org/ns}simple' => 'simple',
-                '{http://sabredav.org/ns}hreflist' => new DAV\Property\HrefList(array('node1','node3')),
+                '{http://sabredav.org/ns}hreflist' => new DAV\Xml\Property\Href(['node1','node3']),
                 '{DAV:}displayname'     => 'Node 2',
             )),
             new DAV\Mock\PropertiesCollection('node3', [], array(
@@ -163,7 +163,7 @@ class ExpandPropertiesTest extends \PHPUnit_Framework_TestCase {
             $count = 1;
             if (!is_int($v1)) $count = $v2;
 
-            $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result));
+            $this->assertEquals($count,count($result), 'we expected ' . $count . ' appearances of ' . $xpath . ' . We found ' . count($result) . ' Full response body: ' . $server->httpResponse->getBodyAsString());
 
         }
 
diff --git a/tests/Sabre/DAVACL/PluginPropertiesTest.php b/tests/Sabre/DAVACL/PluginPropertiesTest.php
index 886e5a0..03218db 100644
--- a/tests/Sabre/DAVACL/PluginPropertiesTest.php
+++ b/tests/Sabre/DAVACL/PluginPropertiesTest.php
@@ -27,7 +27,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(1,count($result[200]));
         $this->assertArrayHasKey('{DAV:}principal-collection-set',$result[200]);
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $result[200]['{DAV:}principal-collection-set']);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-collection-set']);
 
         $expected = [
             'principals1/',
@@ -238,7 +238,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertTrue(isset($result[200]));
         $this->assertTrue(isset($result[200]['{DAV:}alternate-URI-set']));
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $result[200]['{DAV:}alternate-URI-set']);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}alternate-URI-set']);
 
         $this->assertEquals([], $result[200]['{DAV:}alternate-URI-set']->getHrefs());
 
@@ -267,7 +267,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertTrue(isset($result[200]));
         $this->assertTrue(isset($result[200]['{DAV:}principal-URL']));
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\Href', $result[200]['{DAV:}principal-URL']);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-URL']);
 
         $this->assertEquals('principals/user/', $result[200]['{DAV:}principal-URL']->getHref());
 
@@ -296,7 +296,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertTrue(isset($result[200]));
         $this->assertTrue(isset($result[200]['{DAV:}group-member-set']));
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $result[200]['{DAV:}group-member-set']);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-member-set']);
 
         $this->assertEquals([], $result[200]['{DAV:}group-member-set']->getHrefs());
 
@@ -323,7 +323,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertTrue(isset($result[200]));
         $this->assertTrue(isset($result[200]['{DAV:}group-membership']));
-        $this->assertInstanceOf('Sabre\\DAV\\Property\\HrefList', $result[200]['{DAV:}group-membership']);
+        $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-membership']);
 
         $this->assertEquals([], $result[200]['{DAV:}group-membership']->getHrefs());
 
diff --git a/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
index e461c25..64cedd1 100644
--- a/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
+++ b/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php
@@ -10,7 +10,7 @@ require_once 'Sabre/DAVACL/MockPrincipal.php';
 
 class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
 
-    public function testUpdatePropertiesPassthrough() {
+    function testUpdatePropertiesPassthrough() {
 
         $tree = array(
             new DAV\SimpleCollection('foo'),
@@ -30,7 +30,7 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
 
     }
 
-    public function testRemoveGroupMembers() {
+    function testRemoveGroupMembers() {
 
         $tree = array(
             new MockPrincipal('foo','foo'),
@@ -51,31 +51,31 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
 
     }
 
-    public function testSetGroupMembers() {
+    function testSetGroupMembers() {
 
-        $tree = array(
+        $tree = [
             new MockPrincipal('foo','foo'),
-        );
+        ];
         $server = new DAV\Server($tree);
         $server->addPlugin(new Plugin());
 
-        $result = $server->updateProperties('foo', array(
-            '{DAV:}group-member-set' => new DAV\Property\HrefList(array('/bar','/baz'), true),
-        ));
+        $result = $server->updateProperties('foo', [
+            '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar','/baz'], true),
+        ]);
 
-        $expected = array(
+        $expected = [
             '{DAV:}group-member-set' => 200
-        );
+        ];
 
         $this->assertEquals($expected, $result);
-        $this->assertEquals(array('bar','baz'),$tree[0]->getGroupMemberSet());
+        $this->assertEquals(['bar', 'baz'],$tree[0]->getGroupMemberSet());
 
     }
 
     /**
      * @expectedException Sabre\DAV\Exception
      */
-    public function testSetBadValue() {
+    function testSetBadValue() {
 
         $tree = array(
             new MockPrincipal('foo','foo'),
@@ -89,21 +89,21 @@ class PluginUpdatePropertiesTest extends \PHPUnit_Framework_TestCase {
 
     }
 
-    public function testSetBadNode() {
+    function testSetBadNode() {
 
-        $tree = array(
+        $tree = [
             new DAV\SimpleCollection('foo'),
-        );
+        ];
         $server = new DAV\Server($tree);
         $server->addPlugin(new Plugin());
 
-        $result = $server->updateProperties('foo', array(
-            '{DAV:}group-member-set' => new DAV\Property\HrefList(array('/bar','/baz'),false),
-        ));
+        $result = $server->updateProperties('foo', [
+            '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar','/baz'],false),
+        ]);
 
-        $expected = array(
+        $expected = [
             '{DAV:}group-member-set' => 403,
-        );
+        ];
 
         $this->assertEquals($expected, $result);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list