ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
InviteTest.php
Go to the documentation of this file.
1<?php
2
4
6use Sabre\DAV;
9
11
12 function setUp() {
13
14 $this->namespaceMap[CalDAV\Plugin::NS_CALDAV] = 'cal';
15 $this->namespaceMap[CalDAV\Plugin::NS_CALENDARSERVER] = 'cs';
16
17
18 }
19
20 function testSimple() {
21
22 $invite = new Invite([]);
23 $this->assertInstanceOf('Sabre\CalDAV\Xml\Property\Invite', $invite);
24 $this->assertEquals([], $invite->getValue());
25
26 }
27
31 function testSerialize() {
32
33 $property = new Invite([
34 new Sharee([
35 'href' => 'mailto:thedoctor@example.org',
36 'properties' => ['{DAV:}displayname' => 'The Doctor'],
37 'inviteStatus' => SP::INVITE_ACCEPTED,
38 'access' => SP::ACCESS_SHAREDOWNER,
39 ]),
40 new Sharee([
41 'href' => 'mailto:user1@example.org',
42 'inviteStatus' => SP::INVITE_ACCEPTED,
43 'access' => SP::ACCESS_READWRITE,
44 ]),
45 new Sharee([
46 'href' => 'mailto:user2@example.org',
47 'properties' => ['{DAV:}displayname' => 'John Doe'],
48 'inviteStatus' => SP::INVITE_DECLINED,
49 'access' => SP::ACCESS_READ,
50 ]),
51 new Sharee([
52 'href' => 'mailto:user3@example.org',
53 'properties' => ['{DAV:}displayname' => 'Joe Shmoe'],
54 'inviteStatus' => SP::INVITE_NORESPONSE,
55 'access' => SP::ACCESS_READ,
56 'comment' => 'Something, something',
57 ]),
58 new Sharee([
59 'href' => 'mailto:user4@example.org',
60 'properties' => ['{DAV:}displayname' => 'Hoe Boe'],
61 'inviteStatus' => SP::INVITE_INVALID,
62 'access' => SP::ACCESS_READ,
63 ]),
64 ]);
65
66 $xml = $this->write(['{DAV:}root' => $property]);
67
68 $this->assertXmlStringEqualsXmlString(
69'<?xml version="1.0"?>
70<d:root xmlns:d="DAV:" xmlns:cal="' . CalDAV\Plugin::NS_CALDAV . '" xmlns:cs="' . CalDAV\Plugin::NS_CALENDARSERVER . '">
71 <cs:organizer>
72 <d:href>mailto:thedoctor@example.org</d:href>
73 <cs:common-name>The Doctor</cs:common-name>
74 </cs:organizer>
75 <cs:user>
76 <cs:invite-accepted/>
77 <cs:access>
78 <cs:read-write/>
79 </cs:access>
80 <d:href>mailto:user1@example.org</d:href>
81 </cs:user>
82 <cs:user>
83 <cs:invite-declined/>
84 <cs:access>
85 <cs:read/>
86 </cs:access>
87 <d:href>mailto:user2@example.org</d:href>
88 <cs:common-name>John Doe</cs:common-name>
89 </cs:user>
90 <cs:user>
91 <cs:invite-noresponse/>
92 <cs:access>
93 <cs:read/>
94 </cs:access>
95 <d:href>mailto:user3@example.org</d:href>
96 <cs:common-name>Joe Shmoe</cs:common-name>
97 <cs:summary>Something, something</cs:summary>
98 </cs:user>
99 <cs:user>
100 <cs:invite-invalid/>
101 <cs:access>
102 <cs:read/>
103 </cs:access>
104 <d:href>mailto:user4@example.org</d:href>
105 <cs:common-name>Hoe Boe</cs:common-name>
106 </cs:user>
107</d:root>
108', $xml);
109
110 }
111
112}
An exception for terminatinating execution or to throw for unit testing.
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Definition: Plugin.php:38
testSerialize()
@depends testSimple
Definition: InviteTest.php:31
This plugin implements HTTP requests and properties related to:
Definition: Plugin.php:27
This class represents the {DAV:}sharee element.
Definition: Sharee.php:21