diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php | 91 |
1 files changed, 86 insertions, 5 deletions
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()); } |