ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CalendarHomeSharedCalendarsTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\CalDAV;
4
5use Sabre\DAV;
6
8
9 protected $backend;
10
11 function getInstance() {
12
13 $calendars = [
14 [
15 'id' => 1,
16 'principaluri' => 'principals/user1',
17 ],
18 [
19 'id' => 2,
20 '{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/cal1',
21 '{http://sabredav.org/ns}owner-principal' => 'principal/owner',
22 '{http://sabredav.org/ns}read-only' => false,
23 'principaluri' => 'principals/user1',
24 ],
25 ];
26
27 $this->backend = new Backend\MockSharing(
28 $calendars,
29 [],
30 []
31 );
32
33 return new CalendarHome($this->backend, [
34 'uri' => 'principals/user1'
35 ]);
36
37 }
38
39 function testSimple() {
40
41 $instance = $this->getInstance();
42 $this->assertEquals('user1', $instance->getName());
43
44 }
45
46 function testGetChildren() {
47
48 $instance = $this->getInstance();
49 $children = $instance->getChildren();
50 $this->assertEquals(3, count($children));
51
52 // Testing if we got all the objects back.
53 $sharedCalendars = 0;
54 $hasOutbox = false;
55 $hasNotifications = false;
56
57 foreach ($children as $child) {
58
59 if ($child instanceof ISharedCalendar) {
60 $sharedCalendars++;
61 }
62 if ($child instanceof Notifications\ICollection) {
63 $hasNotifications = true;
64 }
65
66 }
67 $this->assertEquals(2, $sharedCalendars);
68 $this->assertTrue($hasNotifications);
69
70 }
71
72 function testShareReply() {
73
74 $instance = $this->getInstance();
75 $result = $instance->shareReply('uri', DAV\Sharing\Plugin::INVITE_DECLINED, 'curi', '1');
76 $this->assertNull($result);
77
78 }
79
80}
$result
An exception for terminatinating execution or to throw for unit testing.
The CalendarHome represents a node that is usually in a users' calendar-homeset.
This interface represents a Calendar that is shared by a different user.
The ICollection Interface.
Definition: ICollection.php:14