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) --- .../dav/tests/Sabre/CalDAV/SharedCalendarTest.php | 91 ++++++++++++++++++++-- 1 file changed, 86 insertions(+), 5 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php index 955831917..337b658f4 100644 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php @@ -20,7 +20,7 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { ); } - $this->backend = new Backend\Mock( + $this->backend = new Backend\MockSharing( array($props), array(), array() @@ -64,18 +64,58 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { 'principal' => 'principals/owner', 'protected' => true, ), + + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner/calendar-proxy-write', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner/calendar-proxy-read', + 'protected' => true, + ), + array( + 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy', + 'principal' => '{DAV:}authenticated', + 'protected' => true, + ), array( 'privilege' => '{DAV:}write', 'principal' => 'principals/owner', 'protected' => true, ), array( - 'privilege' => '{DAV:}read', + 'privilege' => '{DAV:}write', 'principal' => 'principals/owner/calendar-proxy-write', 'protected' => true, ), + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/sharee', + 'protected' => true, + ), array( 'privilege' => '{DAV:}write', + 'principal' => 'principals/sharee', + 'protected' => true, + ), + ); + + $this->assertEquals($expected, $this->getInstance()->getACL()); + + } + + function testGetChildACL() { + + $expected = array( + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}read', 'principal' => 'principals/owner/calendar-proxy-write', 'protected' => true, ), @@ -85,8 +125,13 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { 'protected' => true, ), array( - 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy', - 'principal' => '{DAV:}authenticated', + 'privilege' => '{DAV:}write', + 'principal' => 'principals/owner', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}write', + 'principal' => 'principals/owner/calendar-proxy-write', 'protected' => true, ), array( @@ -101,7 +146,43 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase { ), ); - $this->assertEquals($expected, $this->getInstance()->getACL()); + $this->assertEquals($expected, $this->getInstance()->getChildACL()); + + } + + function testGetChildACLReadOnly() { + + $expected = array( + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner/calendar-proxy-write', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/owner/calendar-proxy-read', + 'protected' => true, + ), + array( + 'privilege' => '{DAV:}read', + 'principal' => 'principals/sharee', + 'protected' => true, + ), + ); + + $props = array( + 'id' => 1, + '{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/original', + '{http://sabredav.org/ns}owner-principal' => 'principals/owner', + '{http://sabredav.org/ns}read-only' => true, + 'principaluri' => 'principals/sharee', + ); + $this->assertEquals($expected, $this->getInstance($props)->getChildACL()); } -- cgit v1.2.3