aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php74
1 files changed, 54 insertions, 20 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
index 2b2690d42..ea744d2cf 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php
@@ -1,6 +1,8 @@
<?php
namespace Sabre\CalDAV;
+
+use Sabre\DAV\PropPatch;
use Sabre\DAVACL;
require_once 'Sabre/CalDAV/TestUtil.php';
@@ -8,7 +10,7 @@ require_once 'Sabre/CalDAV/TestUtil.php';
class CalendarTest extends \PHPUnit_Framework_TestCase {
/**
- * @var Sabre\CalDAV\Backend_PDO
+ * @var Sabre\CalDAV\Backend\PDO
*/
protected $backend;
protected $principalBackend;
@@ -51,9 +53,12 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
*/
function testUpdateProperties() {
- $result = $this->calendar->updateProperties(array(
+ $propPatch = new PropPatch([
'{DAV:}displayname' => 'NewName',
- ));
+ ]);
+
+ $result = $this->calendar->propPatch($propPatch);
+ $result = $propPatch->commit();
$this->assertEquals(true, $result);
@@ -69,9 +74,6 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
$question = array(
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set',
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-data',
- '{urn:ietf:params:xml:ns:caldav}supported-collation-set',
- '{DAV:}owner',
);
$result = $this->calendar->getProperties($question);
@@ -80,11 +82,6 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array('VEVENT','VTODO'), $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue());
- $this->assertTrue($result['{urn:ietf:params:xml:ns:caldav}supported-collation-set'] instanceof Property\SupportedCollationSet);
-
- $this->assertTrue($result['{DAV:}owner'] instanceof DAVACL\Property\Principal);
- $this->assertEquals('principals/user1', $result['{DAV:}owner']->getHref());
-
}
/**
@@ -202,28 +199,28 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
),
array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/user1',
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
),
array(
'privilege' => '{DAV:}read',
- 'principal' => 'principals/user1/calendar-proxy-write',
+ 'principal' => 'principals/user1/calendar-proxy-read',
'protected' => true,
),
array(
- 'privilege' => '{DAV:}write',
- 'principal' => 'principals/user1/calendar-proxy-write',
+ 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+ 'principal' => '{DAV:}authenticated',
'protected' => true,
),
array(
- 'privilege' => '{DAV:}read',
- 'principal' => 'principals/user1/calendar-proxy-read',
+ 'privilege' => '{DAV:}write',
+ 'principal' => 'principals/user1',
'protected' => true,
),
array(
- 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
- 'principal' => '{DAV:}authenticated',
+ 'privilege' => '{DAV:}write',
+ 'principal' => 'principals/user1/calendar-proxy-write',
'protected' => true,
),
);
@@ -251,5 +248,42 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
}
+ function testGetSyncToken() {
+
+ $this->assertEquals(2, $this->calendar->getSyncToken());
+
+ }
+ function testGetSyncToken2() {
+
+ $calendar = new Calendar(new Backend\Mock([],[]), [
+ '{DAV:}sync-token' => 2
+ ]);
+ $this->assertEquals(2, $this->calendar->getSyncToken());
+
+ }
+
+ function testGetSyncTokenNoSyncSupport() {
+
+ $calendar = new Calendar(new Backend\Mock([],[]), []);
+ $this->assertNull($calendar->getSyncToken());
+ }
+
+ function testGetChanges() {
+
+ $this->assertEquals([
+ 'syncToken' => 2,
+ 'modified' => [],
+ 'deleted' => [],
+ 'added' => ['UUID-2345'],
+ ], $this->calendar->getChanges(1, 1));
+
+ }
+
+ function testGetChangesNoSyncSupport() {
+
+ $calendar = new Calendar(new Backend\Mock([],[]), []);
+ $this->assertNull($calendar->getChanges(1,null));
+
+ }
}