[Pkg-owncloud-commits] [php-sabredav] 68/148: Test should not use the DOM.

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:16 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 814309d526dddb435d0cc5143e5bb89476dea38f
Author: Evert Pot <me at evertpot.com>
Date:   Wed Mar 18 19:27:44 2015 -0400

    Test should not use the DOM.
---
 .../Xml/Property/CurrentUserPrivilegeSetTest.php   | 26 ++++++++++------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/tests/Sabre/DAVACL/Xml/Property/CurrentUserPrivilegeSetTest.php b/tests/Sabre/DAVACL/Xml/Property/CurrentUserPrivilegeSetTest.php
index 54e0ed5..835014c 100644
--- a/tests/Sabre/DAVACL/Xml/Property/CurrentUserPrivilegeSetTest.php
+++ b/tests/Sabre/DAVACL/Xml/Property/CurrentUserPrivilegeSetTest.php
@@ -19,24 +19,22 @@ class CurrentUserPrivilegeSetTest extends \PHPUnit_Framework_TestCase {
         $prop = new CurrentUserPrivilegeSet($privileges);
         $xml = (new DAV\Server())->xml->write(['{DAV:}root' => $prop]);
 
-        $xpaths = array(
-            '/d:root' => 1,
-            '/d:root/d:privilege' => 2,
-            '/d:root/d:privilege/d:read' => 1,
-            '/d:root/d:privilege/d:write' => 1,
-        );
-
-        $dom2 = XMLUtil::loadDOMDocument($xml);
-
-        $dxpath = new \DOMXPath($dom2);
-        $dxpath->registerNamespace('d','urn:DAV');
-        foreach($xpaths as $xpath=>$count) {
+        $expected = <<<XML
+<d:root xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
+    <d:privilege>
+        <d:read />
+    </d:privilege>
+    <d:privilege>
+        <d:write />
+    </d:privilege>
+</d:root>
+XML;
 
-            $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : ' . $xpath . ', we could only find ' . $dxpath->query($xpath)->length . ' elements, while we expected ' . $count);
 
-        }
+        $this->assertXmlStringEqualsXmlString($expected, $xml);
 
     }
+
     function testUnserialize() {
 
         $source = '<?xml version="1.0"?>

-- 
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