1<?php 2 3namespace Sabre\CalDAV\Schedule; 4 5use Sabre\DAVACL; 6use Sabre\DAV; 7use Sabre\HTTP; 8 9class PluginPropertiesWithSharedCalendarTest extends \Sabre\DAVServerTest { 10 11 protected $setupCalDAV = true; 12 protected $setupCalDAVScheduling = true; 13 protected $setupCalDAVSharing = true; 14 15 function setUp() { 16 17 parent::setUp(); 18 $this->caldavBackend->createCalendar( 19 'principals/user1', 20 'shared', 21 [ 22 '{http://calendarserver.org/ns/}shared-url' => new DAV\Xml\Property\Href('calendars/user2/default/'), 23 '{http://sabredav.org/ns}read-only' => false, 24 '{http://sabredav.org/ns}owner-principal' => 'principals/user2', 25 ] 26 ); 27 $this->caldavBackend->createCalendar( 28 'principals/user1', 29 'default', 30 [ 31 32 ] 33 ); 34 35 } 36 37 function testPrincipalProperties() { 38 39 $props = $this->server->getPropertiesForPath('/principals/user1',array( 40 '{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL', 41 '{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL', 42 '{urn:ietf:params:xml:ns:caldav}calendar-user-address-set', 43 '{urn:ietf:params:xml:ns:caldav}calendar-user-type', 44 '{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL', 45 )); 46 47 $this->assertArrayHasKey(0,$props); 48 $this->assertArrayHasKey(200,$props[0]); 49 50 $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL',$props[0][200]); 51 $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL']; 52 $this->assertTrue($prop instanceof DAV\Xml\Property\Href); 53 $this->assertEquals('calendars/user1/outbox/',$prop->getHref()); 54 55 $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL',$props[0][200]); 56 $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL']; 57 $this->assertTrue($prop instanceof DAV\Xml\Property\Href); 58 $this->assertEquals('calendars/user1/inbox/',$prop->getHref()); 59 60 $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-address-set',$props[0][200]); 61 $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set']; 62 $this->assertTrue($prop instanceof DAV\Xml\Property\Href); 63 $this->assertEquals(array('mailto:user1.sabredav@sabredav.org','/principals/user1/'),$prop->getHrefs()); 64 65 $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-type',$props[0][200]); 66 $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-user-type']; 67 $this->assertEquals('INDIVIDUAL',$prop); 68 69 $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL',$props[0][200]); 70 $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL']; 71 $this->assertEquals('calendars/user1/default/',$prop->getHref()); 72 73 } 74 75} 76