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