ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CalDAV\Schedule\SchedulingObjectTest Class Reference
+ Inheritance diagram for Sabre\CalDAV\Schedule\SchedulingObjectTest:
+ Collaboration diagram for Sabre\CalDAV\Schedule\SchedulingObjectTest:

Public Member Functions

 setup ()
 
 teardown ()
 
 testSetup ()
 
 testInvalidArg1 ()
 @expectedException InvalidArgumentException More...
 
 testInvalidArg2 ()
 @expectedException InvalidArgumentException More...
 
 testPut ()
 @depends testSetup @expectedException \Sabre\DAV\Exception\MethodNotAllowed More...
 
 testDelete ()
 @depends testSetup More...
 
 testGetLastModified ()
 @depends testSetup More...
 
 testGetSize ()
 @depends testSetup More...
 
 testGetOwner ()
 
 testGetGroup ()
 
 testGetACL ()
 
 testDefaultACL ()
 
 testSetACL ()
 @expectedException \Sabre\DAV\Exception\Forbidden More...
 
 testGet ()
 
 testGetRefetch ()
 
 testGetEtag1 ()
 
 testGetEtag2 ()
 
 testGetSupportedPrivilegesSet ()
 
 testGetSize1 ()
 
 testGetSize2 ()
 
 testGetContentType ()
 
 testGetContentType2 ()
 
 testGetACL2 ()
 

Protected Attributes

 $backend
 
 $calendar
 
 $principalBackend
 
 $data
 
 $data2
 

Detailed Description

Definition at line 7 of file SchedulingObjectTest.php.

Member Function Documentation

◆ setup()

Sabre\CalDAV\Schedule\SchedulingObjectTest::setup ( )

Definition at line 22 of file SchedulingObjectTest.php.

22 {
23
24 if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
25 $this->backend = new Backend\MockScheduling();
26
27 $this->data = <<<ICS
28BEGIN:VCALENDAR
29METHOD:REQUEST
30BEGIN:VEVENT
31SEQUENCE:1
32END:VEVENT
33END:VCALENDAR
34ICS;
35 $this->data = <<<ICS
36BEGIN:VCALENDAR
37METHOD:REQUEST
38BEGIN:VEVENT
39SEQUENCE:2
40END:VEVENT
41END:VCALENDAR
42ICS;
43
44 $this->inbox = new Inbox($this->backend, 'principals/user1');
45 $this->inbox->createFile('item1.ics', $this->data);
46
47 }
$this data['403_header']

References data.

◆ teardown()

Sabre\CalDAV\Schedule\SchedulingObjectTest::teardown ( )

Definition at line 49 of file SchedulingObjectTest.php.

49 {
50
51 unset($this->inbox);
52 unset($this->backend);
53
54 }

◆ testDefaultACL()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testDefaultACL ( )

Definition at line 201 of file SchedulingObjectTest.php.

201 {
202
203 $backend = new Backend\MockScheduling([], []);
204 $calendarObject = new SchedulingObject($backend, ['calendarid' => 1, 'uri' => 'foo', 'principaluri' => 'principals/user1']);
205 $expected = [
206 [
207 'privilege' => '{DAV:}all',
208 'principal' => '{DAV:}owner',
209 'protected' => true,
210 ],
211 [
212 'privilege' => '{DAV:}all',
213 'principal' => 'principals/user1/calendar-proxy-write',
214 'protected' => true,
215 ],
216 [
217 'privilege' => '{DAV:}read',
218 'principal' => 'principals/user1/calendar-proxy-read',
219 'protected' => true,
220 ],
221 ];
222 $this->assertEquals($expected, $calendarObject->getACL());
223
224
225 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testDelete()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testDelete ( )

@depends testSetup

Definition at line 110 of file SchedulingObjectTest.php.

110 {
111
112 $children = $this->inbox->getChildren();
113 $this->assertTrue($children[0] instanceof SchedulingObject);
114
115 $obj = $children[0];
116 $obj->delete();
117
118 $children2 = $this->inbox->getChildren();
119 $this->assertEquals(count($children) - 1, count($children2));
120
121 }

◆ testGet()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGet ( )

Definition at line 240 of file SchedulingObjectTest.php.

240 {
241
242 $children = $this->inbox->getChildren();
243 $this->assertTrue($children[0] instanceof SchedulingObject);
244
245 $obj = $children[0];
246
247 $this->assertEquals($this->data, $obj->get());
248
249 }

References data.

◆ testGetACL()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetACL ( )

Definition at line 173 of file SchedulingObjectTest.php.

173 {
174
175 $expected = [
176 [
177 'privilege' => '{DAV:}all',
178 'principal' => '{DAV:}owner',
179 'protected' => true,
180 ],
181 [
182 'privilege' => '{DAV:}all',
183 'principal' => 'principals/user1/calendar-proxy-write',
184 'protected' => true,
185 ],
186 [
187 'privilege' => '{DAV:}read',
188 'principal' => 'principals/user1/calendar-proxy-read',
189 'protected' => true,
190 ],
191 ];
192
193 $children = $this->inbox->getChildren();
194 $this->assertTrue($children[0] instanceof SchedulingObject);
195
196 $obj = $children[0];
197 $this->assertEquals($expected, $obj->getACL());
198
199 }

◆ testGetACL2()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetACL2 ( )

Definition at line 365 of file SchedulingObjectTest.php.

365 {
366
367 $objectInfo = [
368 'uri' => 'foo',
369 'calendarid' => 1,
370 'acl' => [],
371 ];
372
373 $backend = new Backend\MockScheduling([], []);
374 $obj = new SchedulingObject($backend, $objectInfo);
375 $this->assertEquals([], $obj->getACL());
376
377 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetContentType()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetContentType ( )

Definition at line 339 of file SchedulingObjectTest.php.

339 {
340
341 $objectInfo = [
342 'uri' => 'foo',
343 'calendarid' => 1,
344 ];
345
346 $backend = new Backend\MockScheduling([], []);
347 $obj = new SchedulingObject($backend, $objectInfo);
348 $this->assertEquals('text/calendar; charset=utf-8', $obj->getContentType());
349
350 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetContentType2()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetContentType2 ( )

Definition at line 352 of file SchedulingObjectTest.php.

352 {
353
354 $objectInfo = [
355 'uri' => 'foo',
356 'calendarid' => 1,
357 'component' => 'VEVENT',
358 ];
359
360 $backend = new Backend\MockScheduling([], []);
361 $obj = new SchedulingObject($backend, $objectInfo);
362 $this->assertEquals('text/calendar; charset=utf-8; component=VEVENT', $obj->getContentType());
363
364 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetEtag1()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetEtag1 ( )

Definition at line 266 of file SchedulingObjectTest.php.

266 {
267
268 $objectInfo = [
269 'calendardata' => 'foo',
270 'uri' => 'foo',
271 'etag' => 'bar',
272 'calendarid' => 1
273 ];
274
275 $backend = new Backend\MockScheduling([], []);
276 $obj = new SchedulingObject($backend, $objectInfo);
277
278 $this->assertEquals('bar', $obj->getETag());
279
280 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetEtag2()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetEtag2 ( )

Definition at line 282 of file SchedulingObjectTest.php.

282 {
283
284 $objectInfo = [
285 'calendardata' => 'foo',
286 'uri' => 'foo',
287 'calendarid' => 1
288 ];
289
290 $backend = new Backend\MockScheduling([], []);
291 $obj = new SchedulingObject($backend, $objectInfo);
292
293 $this->assertEquals('"' . md5('foo') . '"', $obj->getETag());
294
295 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetGroup()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetGroup ( )

Definition at line 163 of file SchedulingObjectTest.php.

163 {
164
165 $children = $this->inbox->getChildren();
166 $this->assertTrue($children[0] instanceof SchedulingObject);
167
168 $obj = $children[0];
169 $this->assertNull($obj->getGroup());
170
171 }

◆ testGetLastModified()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetLastModified ( )

@depends testSetup

Definition at line 126 of file SchedulingObjectTest.php.

126 {
127
128 $children = $this->inbox->getChildren();
129 $this->assertTrue($children[0] instanceof SchedulingObject);
130
131 $obj = $children[0];
132
133 $lastMod = $obj->getLastModified();
134 $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod) || is_null($lastMod));
135
136 }

◆ testGetOwner()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetOwner ( )

Definition at line 153 of file SchedulingObjectTest.php.

153 {
154
155 $children = $this->inbox->getChildren();
156 $this->assertTrue($children[0] instanceof SchedulingObject);
157
158 $obj = $children[0];
159 $this->assertEquals('principals/user1', $obj->getOwner());
160
161 }

◆ testGetRefetch()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetRefetch ( )

Definition at line 251 of file SchedulingObjectTest.php.

251 {
252
253 $backend = new Backend\MockScheduling();
254 $backend->createSchedulingObject('principals/user1', 'foo', 'foo');
255
256 $obj = new SchedulingObject($backend, [
257 'calendarid' => 1,
258 'uri' => 'foo',
259 'principaluri' => 'principals/user1',
260 ]);
261
262 $this->assertEquals('foo', $obj->get());
263
264 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetSize()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetSize ( )

@depends testSetup

Definition at line 141 of file SchedulingObjectTest.php.

141 {
142
143 $children = $this->inbox->getChildren();
144 $this->assertTrue($children[0] instanceof SchedulingObject);
145
146 $obj = $children[0];
147
148 $size = $obj->getSize();
149 $this->assertInternalType('int', $size);
150
151 }
$size
Definition: RandomTest.php:84

References $size.

◆ testGetSize1()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetSize1 ( )

Definition at line 311 of file SchedulingObjectTest.php.

311 {
312
313 $objectInfo = [
314 'calendardata' => 'foo',
315 'uri' => 'foo',
316 'calendarid' => 1
317 ];
318
319 $backend = new Backend\MockScheduling([], []);
320 $obj = new SchedulingObject($backend, $objectInfo);
321 $this->assertEquals(3, $obj->getSize());
322
323 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetSize2()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetSize2 ( )

Definition at line 325 of file SchedulingObjectTest.php.

325 {
326
327 $objectInfo = [
328 'uri' => 'foo',
329 'calendarid' => 1,
330 'size' => 4,
331 ];
332
333 $backend = new Backend\MockScheduling([], []);
334 $obj = new SchedulingObject($backend, $objectInfo);
335 $this->assertEquals(4, $obj->getSize());
336
337 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testGetSupportedPrivilegesSet()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testGetSupportedPrivilegesSet ( )

Definition at line 297 of file SchedulingObjectTest.php.

297 {
298
299 $objectInfo = [
300 'calendardata' => 'foo',
301 'uri' => 'foo',
302 'calendarid' => 1
303 ];
304
305 $backend = new Backend\MockScheduling([], []);
306 $obj = new SchedulingObject($backend, $objectInfo);
307 $this->assertNull($obj->getSupportedPrivilegeSet());
308
309 }

References Sabre\CalDAV\Schedule\SchedulingObjectTest\$backend.

◆ testInvalidArg1()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testInvalidArg1 ( )

@expectedException InvalidArgumentException

Definition at line 71 of file SchedulingObjectTest.php.

71 {
72
73 $obj = new SchedulingObject(
74 new Backend\MockScheduling([], []),
75 [],
76 []
77 );
78
79 }

◆ testInvalidArg2()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testInvalidArg2 ( )

@expectedException InvalidArgumentException

Definition at line 84 of file SchedulingObjectTest.php.

84 {
85
86 $obj = new SchedulingObject(
87 new Backend\MockScheduling([], []),
88 [],
89 ['calendarid' => '1']
90 );
91
92 }

◆ testPut()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testPut ( )

@depends testSetup @expectedException \Sabre\DAV\Exception\MethodNotAllowed

Definition at line 98 of file SchedulingObjectTest.php.

98 {
99
100 $children = $this->inbox->getChildren();
101 $this->assertTrue($children[0] instanceof SchedulingObject);
102
103 $children[0]->put('');
104
105 }

◆ testSetACL()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testSetACL ( )

@expectedException \Sabre\DAV\Exception\Forbidden

Definition at line 230 of file SchedulingObjectTest.php.

230 {
231
232 $children = $this->inbox->getChildren();
233 $this->assertTrue($children[0] instanceof SchedulingObject);
234
235 $obj = $children[0];
236 $obj->setACL([]);
237
238 }

◆ testSetup()

Sabre\CalDAV\Schedule\SchedulingObjectTest::testSetup ( )

Definition at line 56 of file SchedulingObjectTest.php.

56 {
57
58 $children = $this->inbox->getChildren();
59 $this->assertTrue($children[0] instanceof SchedulingObject);
60
61 $this->assertInternalType('string', $children[0]->getName());
62 $this->assertInternalType('string', $children[0]->get());
63 $this->assertInternalType('string', $children[0]->getETag());
64 $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType());
65
66 }

Field Documentation

◆ $backend

◆ $calendar

Sabre\CalDAV\Schedule\SchedulingObjectTest::$calendar
protected

Definition at line 16 of file SchedulingObjectTest.php.

◆ $data

Sabre\CalDAV\Schedule\SchedulingObjectTest::$data
protected

Definition at line 19 of file SchedulingObjectTest.php.

◆ $data2

Sabre\CalDAV\Schedule\SchedulingObjectTest::$data2
protected

Definition at line 20 of file SchedulingObjectTest.php.

◆ $principalBackend

Sabre\CalDAV\Schedule\SchedulingObjectTest::$principalBackend
protected

Definition at line 17 of file SchedulingObjectTest.php.


The documentation for this class was generated from the following file: