From 0b02a6d123b2014705998c94ddf3d460948d3eac Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 10 May 2016 17:26:44 -0700 Subject: initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import) --- .../sabre/dav/tests/Sabre/CalDAV/CalendarTest.php | 74 ++++++++++++++++------ 1 file changed, 54 insertions(+), 20 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php') 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 @@ 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)); + + } } -- cgit v1.2.3