[Pkg-owncloud-commits] [php-sabredav] 13/220: test for share-mode serializer.

David Prévot taffit at moszumanska.debian.org
Thu May 12 01:21:02 UTC 2016


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

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

commit 55c6ac4a1daf3f6b937f67ed09ed521801036b30
Author: Evert Pot <me at evertpot.com>
Date:   Wed Jul 29 13:33:06 2015 -0400

    test for share-mode serializer.
---
 lib/DAV/Xml/Property/ShareMode.php             |  2 +-
 tests/Sabre/DAV/Xml/Property/ShareModeTest.php | 36 ++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/lib/DAV/Xml/Property/ShareMode.php b/lib/DAV/Xml/Property/ShareMode.php
index e93d216..f5fd67d 100644
--- a/lib/DAV/Xml/Property/ShareMode.php
+++ b/lib/DAV/Xml/Property/ShareMode.php
@@ -63,7 +63,7 @@ class ShareMode implements XmlSerializable {
      */
     function xmlSerialize(Writer $writer) {
 
-        switch($this->value) {
+        switch ($this->value) {
 
             case self::SHARED :
                 $writer->writeElement('{DAV:}shared');
diff --git a/tests/Sabre/DAV/Xml/Property/ShareModeTest.php b/tests/Sabre/DAV/Xml/Property/ShareModeTest.php
new file mode 100644
index 0000000..83d0cc9
--- /dev/null
+++ b/tests/Sabre/DAV/Xml/Property/ShareModeTest.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Sabre\DAV\Xml\Property;
+
+use Sabre\DAV\Xml\XmlTest;
+
+class ShareModeTest extends XmlTest {
+
+    function testSerialize() {
+
+        $data = ['{DAV:}root' => [
+            [
+                'name'  => '{DAV:}share-mode',
+                'value' => new ShareMode(ShareMode::SHARED),
+            ],
+            [
+                'name'  => '{DAV:}share-mode',
+                'value' => new ShareMode(ShareMode::SHAREDOWNER),
+            ],
+        ]];
+
+        $xml = $this->write($data);
+
+        $expected = <<<XML
+<?xml version="1.0"?>
+<d:root xmlns:d="DAV:">
+  <d:share-mode><d:shared /></d:share-mode>
+  <d:share-mode><d:shared-owner /></d:share-mode>
+</d:root>
+XML;
+
+        $this->assertXmlStringEqualsXmlString($expected, $xml);
+
+    }
+
+}

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



More information about the Pkg-owncloud-commits mailing list