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

Public Member Functions

 setup ()
 
 teardown ()
 
 testSimple ()
 
 testUpdateProperties ()
 testSimple More...
 
 testGetProperties ()
 testSimple More...
 
 testGetChildNotFound ()
 Sabre testSimple More...
 
 testGetChildren ()
 testSimple More...
 
 testChildExists ()
 testGetChildren More...
 
 testCreateDirectory ()
 Sabre More...
 
 testSetName ()
 Sabre More...
 
 testGetLastModified ()
 
 testCreateFile ()
 
 testCreateFileNoSupportedComponents ()
 
 testDelete ()
 
 testGetOwner ()
 
 testGetGroup ()
 
 testGetACL ()
 
 testSetACL ()
 
 testGetSyncToken ()
 
 testGetSyncTokenNoSyncSupport ()
 
 testGetChanges ()
 

Protected Attributes

 $backend
 
 $principalBackend
 
 $calendar
 
 $calendars
 

Detailed Description

Definition at line 9 of file CalendarTest.php.

Member Function Documentation

◆ setup()

Sabre\CalDAV\CalendarTest::setup ( )

Definition at line 25 of file CalendarTest.php.

References Sabre\CalDAV\TestUtil\getBackend().

25  {
26 
27  $this->backend = TestUtil::getBackend();
28 
29  $this->calendars = $this->backend->getCalendarsForUser('principals/user1');
30  $this->assertEquals(2, count($this->calendars));
31  $this->calendar = new Calendar($this->backend, $this->calendars[0]);
32 
33 
34  }
static getBackend()
Definition: TestUtil.php:7
+ Here is the call graph for this function:

◆ teardown()

Sabre\CalDAV\CalendarTest::teardown ( )

Definition at line 36 of file CalendarTest.php.

36  {
37 
38  unset($this->backend);
39 
40  }

◆ testChildExists()

Sabre\CalDAV\CalendarTest::testChildExists ( )

testGetChildren

Definition at line 109 of file CalendarTest.php.

109  {
110 
111  $this->assertFalse($this->calendar->childExists('foo'));
112 
113  $children = $this->calendar->getChildren();
114  $this->assertTrue($this->calendar->childExists($children[0]->getName()));
115  }

◆ testCreateDirectory()

Sabre\CalDAV\CalendarTest::testCreateDirectory ( )

Sabre

Definition at line 122 of file CalendarTest.php.

122  {
123 
124  $this->calendar->createDirectory('hello');
125 
126  }

◆ testCreateFile()

Sabre\CalDAV\CalendarTest::testCreateFile ( )

Definition at line 143 of file CalendarTest.php.

References Sabre\CalDAV\TestUtil\getTestCalendarData().

143  {
144 
145  $file = fopen('php://memory', 'r+');
146  fwrite($file, TestUtil::getTestCalendarData());
147  rewind($file);
148 
149  $this->calendar->createFile('hello', $file);
150 
151  $file = $this->calendar->getChild('hello');
152  $this->assertTrue($file instanceof CalendarObject);
153 
154  }
static getTestCalendarData($type=1)
Definition: TestUtil.php:35
+ Here is the call graph for this function:

◆ testCreateFileNoSupportedComponents()

Sabre\CalDAV\CalendarTest::testCreateFileNoSupportedComponents ( )

Definition at line 156 of file CalendarTest.php.

References Sabre\CalDAV\CalendarTest\$calendar, and Sabre\CalDAV\TestUtil\getTestCalendarData().

156  {
157 
158  $file = fopen('php://memory', 'r+');
159  fwrite($file, TestUtil::getTestCalendarData());
160  rewind($file);
161 
162  $calendar = new Calendar($this->backend, $this->calendars[1]);
163  $calendar->createFile('hello', $file);
164 
165  $file = $calendar->getChild('hello');
166  $this->assertTrue($file instanceof CalendarObject);
167 
168  }
static getTestCalendarData($type=1)
Definition: TestUtil.php:35
+ Here is the call graph for this function:

◆ testDelete()

Sabre\CalDAV\CalendarTest::testDelete ( )

Definition at line 170 of file CalendarTest.php.

References Sabre\CalDAV\CalendarTest\$calendars.

170  {
171 
172  $this->calendar->delete();
173 
174  $calendars = $this->backend->getCalendarsForUser('principals/user1');
175  $this->assertEquals(1, count($calendars));
176  }

◆ testGetACL()

Sabre\CalDAV\CalendarTest::testGetACL ( )

Definition at line 190 of file CalendarTest.php.

References Sabre\CalDAV\Plugin\NS_CALDAV.

190  {
191 
192  $expected = [
193  [
194  'privilege' => '{DAV:}read',
195  'principal' => 'principals/user1',
196  'protected' => true,
197  ],
198  [
199  'privilege' => '{DAV:}read',
200  'principal' => 'principals/user1/calendar-proxy-write',
201  'protected' => true,
202  ],
203  [
204  'privilege' => '{DAV:}read',
205  'principal' => 'principals/user1/calendar-proxy-read',
206  'protected' => true,
207  ],
208  [
209  'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
210  'principal' => '{DAV:}authenticated',
211  'protected' => true,
212  ],
213  [
214  'privilege' => '{DAV:}write',
215  'principal' => 'principals/user1',
216  'protected' => true,
217  ],
218  [
219  'privilege' => '{DAV:}write',
220  'principal' => 'principals/user1/calendar-proxy-write',
221  'protected' => true,
222  ],
223  ];
224  $this->assertEquals($expected, $this->calendar->getACL());
225 
226  }
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33

◆ testGetChanges()

Sabre\CalDAV\CalendarTest::testGetChanges ( )

Definition at line 250 of file CalendarTest.php.

250  {
251 
252  $this->assertNull($this->calendar->getChanges(1, 1));
253 
254  }

◆ testGetChildNotFound()

Sabre\CalDAV\CalendarTest::testGetChildNotFound ( )

Sabre testSimple

Definition at line 88 of file CalendarTest.php.

88  {
89 
90  $this->calendar->getChild('randomname');
91 
92  }

◆ testGetChildren()

Sabre\CalDAV\CalendarTest::testGetChildren ( )

testSimple

Definition at line 97 of file CalendarTest.php.

97  {
98 
99  $children = $this->calendar->getChildren();
100  $this->assertEquals(1, count($children));
101 
102  $this->assertTrue($children[0] instanceof CalendarObject);
103 
104  }

◆ testGetGroup()

Sabre\CalDAV\CalendarTest::testGetGroup ( )

Definition at line 184 of file CalendarTest.php.

184  {
185 
186  $this->assertNull($this->calendar->getGroup());
187 
188  }

◆ testGetLastModified()

Sabre\CalDAV\CalendarTest::testGetLastModified ( )

Definition at line 137 of file CalendarTest.php.

137  {
138 
139  $this->assertNull($this->calendar->getLastModified());
140 
141  }

◆ testGetOwner()

Sabre\CalDAV\CalendarTest::testGetOwner ( )

Definition at line 178 of file CalendarTest.php.

178  {
179 
180  $this->assertEquals('principals/user1', $this->calendar->getOwner());
181 
182  }

◆ testGetProperties()

Sabre\CalDAV\CalendarTest::testGetProperties ( )

testSimple

Definition at line 70 of file CalendarTest.php.

References $result.

70  {
71 
72  $question = [
73  '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set',
74  ];
75 
76  $result = $this->calendar->getProperties($question);
77 
78  foreach ($question as $q) $this->assertArrayHasKey($q, $result);
79 
80  $this->assertEquals(['VEVENT', 'VTODO'], $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue());
81 
82  }
$result

◆ testGetSyncToken()

Sabre\CalDAV\CalendarTest::testGetSyncToken ( )

Definition at line 237 of file CalendarTest.php.

237  {
238 
239  $this->assertNull($this->calendar->getSyncToken());
240 
241  }

◆ testGetSyncTokenNoSyncSupport()

Sabre\CalDAV\CalendarTest::testGetSyncTokenNoSyncSupport ( )

Definition at line 243 of file CalendarTest.php.

References Sabre\CalDAV\CalendarTest\$calendar.

243  {
244 
245  $calendar = new Calendar(new Backend\Mock([], []), []);
246  $this->assertNull($calendar->getSyncToken());
247 
248  }

◆ testSetACL()

Sabre\CalDAV\CalendarTest::testSetACL ( )

Definition at line 231 of file CalendarTest.php.

231  {
232 
233  $this->calendar->setACL([]);
234 
235  }

◆ testSetName()

Sabre\CalDAV\CalendarTest::testSetName ( )

Sabre

Definition at line 131 of file CalendarTest.php.

131  {
132 
133  $this->calendar->setName('hello');
134 
135  }

◆ testSimple()

Sabre\CalDAV\CalendarTest::testSimple ( )

Definition at line 42 of file CalendarTest.php.

42  {
43 
44  $this->assertEquals($this->calendars[0]['uri'], $this->calendar->getName());
45 
46  }

◆ testUpdateProperties()

Sabre\CalDAV\CalendarTest::testUpdateProperties ( )

testSimple

Definition at line 51 of file CalendarTest.php.

References $result.

51  {
52 
53  $propPatch = new PropPatch([
54  '{DAV:}displayname' => 'NewName',
55  ]);
56 
57  $result = $this->calendar->propPatch($propPatch);
58  $result = $propPatch->commit();
59 
60  $this->assertEquals(true, $result);
61 
62  $calendars2 = $this->backend->getCalendarsForUser('principals/user1');
63  $this->assertEquals('NewName', $calendars2[0]['{DAV:}displayname']);
64 
65  }
$result

Field Documentation

◆ $backend

Sabre\CalDAV\CalendarTest::$backend
protected

Definition at line 14 of file CalendarTest.php.

◆ $calendar

Sabre\CalDAV\CalendarTest::$calendar
protected

◆ $calendars

Sabre\CalDAV\CalendarTest::$calendars
protected

Definition at line 23 of file CalendarTest.php.

Referenced by Sabre\CalDAV\CalendarTest\testDelete().

◆ $principalBackend

Sabre\CalDAV\CalendarTest::$principalBackend
protected

Definition at line 15 of file CalendarTest.php.


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