aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
committerfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
commitb35122f7a6ad42756c35bb60ba1f06c3dcd45c77 (patch)
treeccdf373ce6475d264778523259cc32899b732fe7 /vendor/sabre/dav/tests/Sabre/CalDAV/Schedule
parente3504df514d306cfe6b83e44a11f550664564af4 (diff)
downloadvolse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.gz
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.bz2
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.zip
add sabre (1.8.x) via composer in the !@#$ place it wants to be
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/Schedule')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/IMip/Mock.php52
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php68
2 files changed, 120 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/IMip/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/IMip/Mock.php
new file mode 100644
index 000000000..200274ce8
--- /dev/null
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/IMip/Mock.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace Sabre\CalDAV\Schedule\IMip;
+
+/**
+ * iMIP handler.
+ *
+ * This class is responsible for sending out iMIP messages. iMIP is the
+ * email-based transport for iTIP. iTIP deals with scheduling operations for
+ * iCalendar objects.
+ *
+ * If you want to customize the email that gets sent out, you can do so by
+ * extending this class and overriding the sendMessage method.
+ *
+ * @package Sabre
+ * @subpackage CalDAV
+ * @copyright Copyright (C) 2007-2013 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Mock extends \Sabre\CalDAV\Schedule\IMip {
+
+ protected $emails = array();
+
+ /**
+ * This function is reponsible for sending the actual email.
+ *
+ * @param string $to Recipient email address
+ * @param string $subject Subject of the email
+ * @param string $body iCalendar body
+ * @param array $headers List of headers
+ * @return void
+ */
+ protected function mail($to, $subject, $body, array $headers) {
+
+ $this->emails[] = array(
+ 'to' => $to,
+ 'subject' => $subject,
+ 'body' => $body,
+ 'headers' => $headers,
+ );
+
+ }
+
+ public function getSentEmails() {
+
+ return $this->emails;
+
+ }
+
+
+}
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php
new file mode 100644
index 000000000..60ce9a2ad
--- /dev/null
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php
@@ -0,0 +1,68 @@
+<?php
+
+namespace Sabre\CalDAV\Schedule;
+use Sabre\CalDAV;
+use Sabre\DAV;
+
+class OutboxTest extends \PHPUnit_Framework_TestCase {
+
+ function testSetup() {
+
+ $outbox = new Outbox('principals/user1');
+ $this->assertEquals('outbox', $outbox->getName());
+ $this->assertEquals(array(), $outbox->getChildren());
+ $this->assertEquals('principals/user1', $outbox->getOwner());
+ $this->assertEquals(null, $outbox->getGroup());
+
+ $this->assertEquals(array(
+ array(
+ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy',
+ 'principal' => 'principals/user1',
+ 'protected' => true,
+ ),
+ array(
+ 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent',
+ 'principal' => 'principals/user1',
+ 'protected' => true,
+ ),
+ array(
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/user1',
+ 'protected' => true,
+ ),
+ ), $outbox->getACL());
+
+ $ok = false;
+ try {
+ $outbox->setACL(array());
+ } catch (DAV\Exception\MethodNotAllowed $e) {
+ $ok = true;
+ }
+ if (!$ok) {
+ $this->fail('Exception was not emitted');
+ }
+
+ }
+
+ function testGetSupportedPrivilegeSet() {
+
+ $outbox = new Outbox('principals/user1');
+ $r = $outbox->getSupportedPrivilegeSet();
+
+ $ok = 0;
+ foreach($r['aggregates'] as $priv) {
+
+ if ($priv['privilege'] == '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-query-freebusy') {
+ $ok++;
+ }
+ if ($priv['privilege'] == '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-post-vevent') {
+ $ok++;
+ }
+ }
+
+ $this->assertEquals(2, $ok, "We're missing one or more privileges");
+
+ }
+
+
+}