ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CalendarHomeTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\CalDAV;
4
5use Sabre\DAV;
7
9
13 protected $usercalendars;
14
18 protected $backend;
19
20 function setup() {
21
22 $this->backend = TestUtil::getBackend();
23 $this->usercalendars = new CalendarHome($this->backend, [
24 'uri' => 'principals/user1'
25 ]);
26
27 }
28
29 function testSimple() {
30
31 $this->assertEquals('user1', $this->usercalendars->getName());
32
33 }
34
40
41 $this->usercalendars->getChild('randomname');
42
43 }
44
45 function testChildExists() {
46
47 $this->assertFalse($this->usercalendars->childExists('foo'));
48 $this->assertTrue($this->usercalendars->childExists('UUID-123467'));
49
50 }
51
52 function testGetOwner() {
53
54 $this->assertEquals('principals/user1', $this->usercalendars->getOwner());
55
56 }
57
58 function testGetGroup() {
59
60 $this->assertNull($this->usercalendars->getGroup());
61
62 }
63
64 function testGetACL() {
65
66 $expected = [
67 [
68 'privilege' => '{DAV:}read',
69 'principal' => 'principals/user1',
70 'protected' => true,
71 ],
72 [
73 'privilege' => '{DAV:}write',
74 'principal' => 'principals/user1',
75 'protected' => true,
76 ],
77 [
78 'privilege' => '{DAV:}read',
79 'principal' => 'principals/user1/calendar-proxy-write',
80 'protected' => true,
81 ],
82 [
83 'privilege' => '{DAV:}write',
84 'principal' => 'principals/user1/calendar-proxy-write',
85 'protected' => true,
86 ],
87 [
88 'privilege' => '{DAV:}read',
89 'principal' => 'principals/user1/calendar-proxy-read',
90 'protected' => true,
91 ],
92 ];
93 $this->assertEquals($expected, $this->usercalendars->getACL());
94
95 }
96
100 function testSetACL() {
101
102 $this->usercalendars->setACL([]);
103
104 }
105
110 function testSetName() {
111
112 $this->usercalendars->setName('bla');
113
114 }
115
120 function testDelete() {
121
122 $this->usercalendars->delete();
123
124 }
125
130
131 $this->assertNull($this->usercalendars->getLastModified());
132
133 }
134
139 function testCreateFile() {
140
141 $this->usercalendars->createFile('bla');
142
143 }
144
145
151
152 $this->usercalendars->createDirectory('bla');
153
154 }
155
160
161 $mkCol = new MkCol(
162 ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar'],
163 []
164 );
165 $result = $this->usercalendars->createExtendedCollection('newcalendar', $mkCol);
166 $this->assertNull($result);
167 $cals = $this->backend->getCalendarsForUser('principals/user1');
168 $this->assertEquals(3, count($cals));
169
170 }
171
177
178 $mkCol = new MkCol(
179 ['{DAV:}collection', '{DAV:}blabla'],
180 []
181 );
182 $this->usercalendars->createExtendedCollection('newcalendar', $mkCol);
183
184 }
185
191
192 $mkCol = new MkCol(
193 ['{DAV:}collection'],
194 []
195 );
196 $this->usercalendars->createExtendedCollection('newcalendar', $mkCol);
197
198 }
199
201
202 $this->assertNull($this->usercalendars->getSupportedPrivilegeSet());
203
204 }
205
210
211 $this->usercalendars->shareReply('uri', DAV\Sharing\Plugin::INVITE_DECLINED, 'curi', '1');
212
213 }
214
215}
$result
An exception for terminatinating execution or to throw for unit testing.
testShareReplyFail()
@expectedException Sabre\DAV\Exception\NotImplemented
testCreateExtendedCollectionBadResourceType()
@expectedException Sabre\DAV\Exception\InvalidResourceType @depends testSimple
testCreateExtendedCollection()
@depends testSimple
testCreateFile()
@expectedException \Sabre\DAV\Exception\MethodNotAllowed @depends testSimple
testGetLastModified()
@depends testSimple
testSetACL()
@expectedException \Sabre\DAV\Exception\Forbidden
testSetName()
@expectedException \Sabre\DAV\Exception\Forbidden @depends testSimple
testDelete()
@expectedException \Sabre\DAV\Exception\Forbidden @depends testSimple
testGetChildNotFound()
@expectedException Sabre\DAV\Exception\NotFound @depends testSimple
testCreateExtendedCollectionNotACalendar()
@expectedException Sabre\DAV\Exception\InvalidResourceType @depends testSimple
testCreateDirectory()
@expectedException Sabre\DAV\Exception\MethodNotAllowed @depends testSimple
The CalendarHome represents a node that is usually in a users' calendar-homeset.
static getBackend()
Definition: TestUtil.php:7
This class represents a MKCOL operation.
Definition: MkCol.php:23