[Pkg-owncloud-commits] [php-sabredav] 96/148: More CalDAV plugins
David Prévot
taffit at moszumanska.debian.org
Wed Apr 15 01:37:22 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 03e0dbfb012dd6812d33c62f3b24d2316d10d75f
Author: Evert Pot <me at evertpot.com>
Date: Fri Mar 27 17:26:34 2015 -0700
More CalDAV plugins
---
tests/Sabre/CalDAV/Notifications/PluginTest.php | 4 ++
tests/Sabre/CalDAV/PluginTest.php | 48 ++++++++++++-
tests/Sabre/CalDAV/Schedule/IMipPluginTest.php | 10 +++
tests/Sabre/CalDAV/Schedule/PluginBasicTest.php | 10 +++
tests/Sabre/CalDAV/SharingPluginTest.php | 4 ++
tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php | 78 ++++++++++++++++++++++
6 files changed, 153 insertions(+), 1 deletion(-)
diff --git a/tests/Sabre/CalDAV/Notifications/PluginTest.php b/tests/Sabre/CalDAV/Notifications/PluginTest.php
index 0652ddd..a1ef69f 100644
--- a/tests/Sabre/CalDAV/Notifications/PluginTest.php
+++ b/tests/Sabre/CalDAV/Notifications/PluginTest.php
@@ -68,6 +68,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([], $this->plugin->getFeatures());
$this->assertEquals('notifications', $this->plugin->getPluginName());
+ $this->assertEquals(
+ 'notifications',
+ $this->plugin->getPluginInfo()['name']
+ );
}
diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php
index 7134b90..bee8638 100644
--- a/tests/Sabre/CalDAV/PluginTest.php
+++ b/tests/Sabre/CalDAV/PluginTest.php
@@ -101,6 +101,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array('MKCALENDAR'), $this->plugin->getHTTPMethods('calendars/user1/randomnewcalendar'));
$this->assertEquals(array('calendar-access','calendar-proxy'), $this->plugin->getFeatures());
+ $this->assertEquals(
+ 'caldav',
+ $this->plugin->getPluginInfo()['name']
+ );
}
@@ -427,6 +431,23 @@ END:VCALENDAR';
}
+ function testMkCalendarBadXml() {
+
+ $request = HTTP\Sapi::createFromServerArray(array(
+ 'REQUEST_METHOD' => 'MKCALENDAR',
+ 'REQUEST_URI' => '/blabla',
+ ));
+
+ $body = 'This is not xml';
+
+ $request->setBody($body);
+ $this->server->httpRequest = $request;
+ $this->server->exec();
+
+ $this->assertEquals(400, $this->response->status);
+
+ }
+
function testPrincipalProperties() {
$httpRequest = HTTP\Sapi::createFromServerArray(array(
@@ -435,10 +456,11 @@ END:VCALENDAR';
$this->server->httpRequest = $httpRequest;
$props = $this->server->getPropertiesForPath('/principals/user1',array(
- '{urn:ietf:params:xml:ns:caldav}calendar-home-set',
+ '{' . Plugin::NS_CALDAV . '}calendar-home-set',
'{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-read-for',
'{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-write-for',
'{' . Plugin::NS_CALENDARSERVER . '}notification-URL',
+ '{' . Plugin::NS_CALENDARSERVER . '}email-address-set',
));
$this->assertArrayHasKey(0,$props);
@@ -460,6 +482,10 @@ END:VCALENDAR';
$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
$this->assertEquals(array('principals/admin'), $prop->getHrefs());
+ $this->assertArrayHasKey('{' . Plugin::NS_CALENDARSERVER . '}email-address-set',$props[0][200]);
+ $prop = $props[0][200]['{' . Plugin::NS_CALENDARSERVER . '}email-address-set'];
+ $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\EmailAddressSet', $prop);
+ $this->assertEquals(['user1.sabredav at sabredav.org'],$prop->getValue());
}
@@ -1021,4 +1047,24 @@ XML;
}
+ /**
+ * @depends testSupportedReportSetPropertyNonCalendar
+ */
+ function testCalendarProperties() {
+
+ $ns = '{urn:ietf:params:xml:ns:caldav}';
+ $props = $this->server->getProperties('calendars/user1/UUID-123467', [
+ $ns . 'max-resource-size',
+ $ns . 'supported-calendar-data',
+ $ns . 'supported-collation-set',
+ ]);
+
+ $this->assertEquals([
+ $ns . 'max-resource-size' => 10000000,
+ $ns . 'supported-calendar-data' => new Xml\Property\SupportedCalendarData(),
+ $ns . 'supported-collation-set' => new Xml\Property\SupportedCollationSet(),
+ ], $props);
+
+ }
+
}
diff --git a/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php b/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
index e2ab17b..ecaa16c 100644
--- a/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
+++ b/tests/Sabre/CalDAV/Schedule/IMipPluginTest.php
@@ -8,6 +8,16 @@ use Sabre\DAV\Server;
class IMipPluginTest extends \PHPUnit_Framework_TestCase {
+ function testGetPluginInfo() {
+
+ $plugin = new IMipPlugin('system at example.com');
+ $this->assertEquals(
+ 'imip',
+ $plugin->getPluginInfo()['name']
+ );
+
+ }
+
function testDeliverReply() {
$message = new Message();
diff --git a/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php b/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php
index 5c31e4b..375e6e9 100644
--- a/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php
+++ b/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php
@@ -7,6 +7,16 @@ class PluginBasicTest extends \Sabre\DAVServerTest {
public $setupCalDAV = true;
public $setupCalDAVScheduling = true;
+ function testSimple() {
+
+ $plugin = new Plugin();
+ $this->assertEquals(
+ 'caldav-schedule',
+ $plugin->getPluginInfo()['name']
+ );
+
+ }
+
function testOptions() {
$plugin = new Plugin();
diff --git a/tests/Sabre/CalDAV/SharingPluginTest.php b/tests/Sabre/CalDAV/SharingPluginTest.php
index 1d50074..b4270da 100644
--- a/tests/Sabre/CalDAV/SharingPluginTest.php
+++ b/tests/Sabre/CalDAV/SharingPluginTest.php
@@ -46,6 +46,10 @@ class SharingPluginTest extends \Sabre\DAVServerTest {
function testSimple() {
$this->assertInstanceOf('Sabre\\CalDAV\\SharingPlugin', $this->server->getPlugin('caldav-sharing'));
+ $this->assertEquals(
+ 'caldav-sharing',
+ $this->caldavSharingPlugin->getPluginInfo()['name']
+ );
}
diff --git a/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php
new file mode 100644
index 0000000..eca35c9
--- /dev/null
+++ b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php
@@ -0,0 +1,78 @@
+<?php
+
+namespace Sabre\CalDAV\Xml\Request;
+
+use Sabre\DAV\Xml\XmlTest;
+use Sabre\CalDAV\SharingPlugin;
+
+class InviteReplyTest extends XmlTest {
+
+ protected $elementMap = [
+ '{http://calendarserver.org/ns/}invite-reply' => 'Sabre\\CalDAV\\Xml\\Request\\InviteReply',
+ ];
+
+ function testDeserialize() {
+
+ $xml = <<<XML
+<?xml version="1.0"?>
+<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
+ <d:href>/principal/1</d:href>
+ <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
+ <cs:invite-accepted />
+ <cs:in-reply-to>blabla</cs:in-reply-to>
+ <cs:summary>Summary</cs:summary>
+</cs:invite-reply>
+XML;
+
+ $result = $this->parse($xml);
+ $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', SharingPlugin::STATUS_ACCEPTED);
+
+ $this->assertEquals(
+ $inviteReply,
+ $result['value']
+ );
+
+ }
+
+ function testDeserializeDeclined() {
+
+ $xml = <<<XML
+<?xml version="1.0"?>
+<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
+ <d:href>/principal/1</d:href>
+ <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
+ <cs:invite-declined />
+ <cs:in-reply-to>blabla</cs:in-reply-to>
+ <cs:summary>Summary</cs:summary>
+</cs:invite-reply>
+XML;
+
+ $result = $this->parse($xml);
+ $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', SharingPlugin::STATUS_DECLINED);
+
+ $this->assertEquals(
+ $inviteReply,
+ $result['value']
+ );
+
+ }
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\BadRequest
+ */
+ function testDeserializeNoHostUrl() {
+
+ $xml = <<<XML
+<?xml version="1.0"?>
+<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
+ <d:href>/principal/1</d:href>
+ <cs:invite-declined />
+ <cs:in-reply-to>blabla</cs:in-reply-to>
+ <cs:summary>Summary</cs:summary>
+</cs:invite-reply>
+XML;
+
+ $this->parse($xml);
+
+ }
+}
--
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