[Pkg-owncloud-commits] [php-sabredav] 46/220: Tested the Invite property.
David Prévot
taffit at moszumanska.debian.org
Thu May 12 01:21:06 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 08bf65d726cd3d0ddf99045783a30c6410e09d4b
Author: Evert Pot <me at evertpot.com>
Date: Mon Jan 11 21:10:34 2016 -0500
Tested the Invite property.
---
lib/DAV/Xml/Element/Sharee.php | 11 +++--
tests/Sabre/DAV/Xml/Property/InviteTest.php | 76 +++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/lib/DAV/Xml/Element/Sharee.php b/lib/DAV/Xml/Element/Sharee.php
index d6b4fb3..d4d523c 100644
--- a/lib/DAV/Xml/Element/Sharee.php
+++ b/lib/DAV/Xml/Element/Sharee.php
@@ -4,6 +4,7 @@ namespace Sabre\DAV\Xml\Element;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Sharing\Plugin;
+use Sabre\DAV\Xml\Property\ShareAccess;
use Sabre\Xml\Deserializer;
use Sabre\Xml\Element;
use Sabre\Xml\Reader;
@@ -89,22 +90,22 @@ class Sharee implements Element {
function xmlSerialize(Writer $writer) {
$writer->write([
- '{DAV:}href' => $href,
+ '{DAV:}href' => $this->href,
'{DAV:}prop' => $this->properties,
'{DAV:}share-access' => new ShareAccess($this->shareAccess),
]);
switch($this->inviteStatus) {
case Plugin::INVITE_NORESPONSE :
- $write->writeElement('{DAV:}invite-noresponse');
+ $writer->writeElement('{DAV:}invite-noresponse');
break;
case Plugin::INVITE_ACCEPTED :
- $write->writeElement('{DAV:}invite-accepted');
+ $writer->writeElement('{DAV:}invite-accepted');
break;
case Plugin::INVITE_DECLINED :
- $write->writeElement('{DAV:}invite-declined');
+ $writer->writeElement('{DAV:}invite-declined');
break;
case Plugin::INVITE_INVALID :
- $write->writeElement('{DAV:}invite-invalid');
+ $writer->writeElement('{DAV:}invite-invalid');
break;
}
diff --git a/tests/Sabre/DAV/Xml/Property/InviteTest.php b/tests/Sabre/DAV/Xml/Property/InviteTest.php
new file mode 100644
index 0000000..bf7ebcd
--- /dev/null
+++ b/tests/Sabre/DAV/Xml/Property/InviteTest.php
@@ -0,0 +1,76 @@
+<?php
+
+namespace Sabre\DAV\Xml\Property;
+
+use Sabre\DAV\Sharing\Plugin;
+use Sabre\DAV\Xml\Element\Sharee;
+use Sabre\DAV\Xml\XmlTest;
+
+class InviteTestTest extends XmlTest {
+
+ function testSerialize() {
+
+ $sharees = [
+ new Sharee(),
+ new Sharee(),
+ new Sharee(),
+ new Sharee()
+ ];
+ $sharees[0]->href = 'mailto:foo at example.org';
+ $sharees[0]->properties['{DAV:}displayname'] = 'Foo Bar';
+ $sharees[0]->shareAccess = Plugin::ACCESS_SHAREDOWNER;
+ $sharees[0]->inviteStatus = Plugin::INVITE_ACCEPTED;
+
+ $sharees[1]->href = 'mailto:bar at example.org';
+ $sharees[1]->shareAccess = Plugin::ACCESS_READ;
+ $sharees[1]->inviteStatus = Plugin::INVITE_DECLINED;
+
+ $sharees[2]->href = 'mailto:baz at example.org';
+ $sharees[2]->shareAccess = Plugin::ACCESS_READWRITE;
+ $sharees[2]->inviteStatus = Plugin::INVITE_NORESPONSE;
+
+ $sharees[3]->href = 'mailto:zim at example.org';
+ $sharees[3]->shareAccess = Plugin::ACCESS_READWRITE;
+ $sharees[3]->inviteStatus = Plugin::INVITE_INVALID;
+
+ $invite = new Invite($sharees);
+
+ $xml = $this->write(['{DAV:}root' => $invite]);
+
+ $expected = <<<XML
+<?xml version="1.0"?>
+<d:root xmlns:d="DAV:">
+<d:sharee>
+ <d:href>mailto:foo at example.org</d:href>
+ <d:prop>
+ <d:displayname>Foo Bar</d:displayname>
+ </d:prop>
+ <d:share-access><d:shared-owner /></d:share-access>
+ <d:invite-accepted/>
+</d:sharee>
+<d:sharee>
+ <d:href>mailto:bar at example.org</d:href>
+ <d:prop />
+ <d:share-access><d:read /></d:share-access>
+ <d:invite-declined/>
+</d:sharee>
+<d:sharee>
+ <d:href>mailto:baz at example.org</d:href>
+ <d:prop />
+ <d:share-access><d:read-write /></d:share-access>
+ <d:invite-noresponse/>
+</d:sharee>
+<d:sharee>
+ <d:href>mailto:zim at example.org</d:href>
+ <d:prop />
+ <d:share-access><d:read-write /></d:share-access>
+ <d:invite-invalid/>
+</d:sharee>
+</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