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

Public Member Functions

 setUp ()
 
 testInit ()
 
 testBeforeMethod ()
 
 testBeforeMethodNoVersion ()
 
 testBeforeMethodNoExport ()
 
 testACLIntegrationBlocked ()
 
 testACLIntegrationNotBlocked ()
 
 testBadStartParam ()
 
 testBadEndParam ()
 
 testFilterStartEnd ()
 
 testExpandNoStart ()
 
 testExpand ()
 
 testJCal ()
 
 testJCalInUrl ()
 
 testNegotiateDefault ()
 
 testFilterComponentVEVENT ()
 
 testFilterComponentVTODO ()
 
 testFilterComponentBadComponent ()
 
 testContentDisposition ()
 
 testContentDispositionJson ()
 
 testContentDispositionBadChars ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Protected Attributes

 $setupCalDAV = true
 
 $icsExportPlugin
 
- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Definition at line 10 of file ICSExportPluginTest.php.

Member Function Documentation

◆ setUp()

Sabre\CalDAV\ICSExportPluginTest::setUp ( )

Definition at line 16 of file ICSExportPluginTest.php.

References $id.

16  {
17 
18  parent::setUp();
19  $this->icsExportPlugin = new ICSExportPlugin();
20  $this->server->addPlugin(
21  $this->icsExportPlugin
22  );
23 
24  $id = $this->caldavBackend->createCalendar(
25  'principals/admin',
26  'UUID-123467',
27  [
28  '{DAV:}displayname' => 'Hello!',
29  '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF',
30  ]
31  );
32 
33  $this->caldavBackend->createCalendarObject(
34  $id,
35  'event-1',
36  <<<ICS
37 BEGIN:VCALENDAR
38 BEGIN:VTIMEZONE
39 TZID:Europe/Amsterdam
40 END:VTIMEZONE
41 BEGIN:VEVENT
42 UID:event-1
43 DTSTART;TZID=Europe/Amsterdam:20151020T000000
44 END:VEVENT
45 END:VCALENDAR
46 ICS
47  );
48  $this->caldavBackend->createCalendarObject(
49  $id,
50  'todo-1',
51  <<<ICS
52 BEGIN:VCALENDAR
53 BEGIN:VTODO
54 UID:todo-1
55 END:VTODO
56 END:VCALENDAR
57 ICS
58  );
59 
60 
61  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ testACLIntegrationBlocked()

Sabre\CalDAV\ICSExportPluginTest::testACLIntegrationBlocked ( )

Definition at line 135 of file ICSExportPluginTest.php.

References Sabre\DAVServerTest\$aclPlugin, $request, and Sabre\DAVServerTest\request().

135  {
136 
137  $aclPlugin = new DAVACL\Plugin();
138  $aclPlugin->allowUnauthenticatedAccess = false;
139  $this->server->addPlugin(
140  $aclPlugin
141  );
142 
143  $request = new HTTP\Request(
144  'GET',
145  '/calendars/admin/UUID-123467?export'
146  );
147 
148  $this->request($request, 403);
149 
150  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
+ Here is the call graph for this function:

◆ testACLIntegrationNotBlocked()

Sabre\CalDAV\ICSExportPluginTest::testACLIntegrationNotBlocked ( )

Definition at line 152 of file ICSExportPluginTest.php.

References Sabre\DAVServerTest\$aclPlugin, $request, $response, Sabre\DAVServerTest\autoLogin(), Sabre\VObject\Reader\read(), Sabre\DAVServerTest\request(), and Sabre\DAV\Version\VERSION.

152  {
153 
154  $aclPlugin = new DAVACL\Plugin();
155  $aclPlugin->allowUnauthenticatedAccess = false;
156  $this->server->addPlugin(
157  $aclPlugin
158  );
159  $this->server->addPlugin(
160  new Plugin()
161  );
162 
163  $this->autoLogin('admin');
164 
165  $request = new HTTP\Request(
166  'GET',
167  '/calendars/admin/UUID-123467?export'
168  );
169 
170  $response = $this->request($request, 200);
171  $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
172 
173  $obj = VObject\Reader::read($response->body);
174 
175  $this->assertEquals(8, count($obj->children()));
176  $this->assertEquals(1, count($obj->VERSION));
177  $this->assertEquals(1, count($obj->CALSCALE));
178  $this->assertEquals(1, count($obj->PRODID));
179  $this->assertTrue(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
180  $this->assertEquals(1, count($obj->VTIMEZONE));
181  $this->assertEquals(1, count($obj->VEVENT));
182 
183  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
autoLogin($userName)
This function takes a username and sets the server in a state where this user is logged in...
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testBadEndParam()

Sabre\CalDAV\ICSExportPluginTest::testBadEndParam ( )

Definition at line 195 of file ICSExportPluginTest.php.

References $request, and Sabre\DAVServerTest\request().

195  {
196 
197  $request = new HTTP\Request(
198  'GET',
199  '/calendars/admin/UUID-123467?export&end=foo'
200  );
201  $this->request($request, 400);
202 
203  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
+ Here is the call graph for this function:

◆ testBadStartParam()

Sabre\CalDAV\ICSExportPluginTest::testBadStartParam ( )

Definition at line 185 of file ICSExportPluginTest.php.

References $request, and Sabre\DAVServerTest\request().

185  {
186 
187  $request = new HTTP\Request(
188  'GET',
189  '/calendars/admin/UUID-123467?export&start=foo'
190  );
191  $this->request($request, 400);
192 
193  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
+ Here is the call graph for this function:

◆ testBeforeMethod()

Sabre\CalDAV\ICSExportPluginTest::testBeforeMethod ( )

Definition at line 74 of file ICSExportPluginTest.php.

References $request, $response, Sabre\VObject\Reader\read(), Sabre\DAVServerTest\request(), and Sabre\DAV\Version\VERSION.

74  {
75 
76  $request = new HTTP\Request(
77  'GET',
78  '/calendars/admin/UUID-123467?export'
79  );
80 
81  $response = $this->request($request);
82 
83  $this->assertEquals(200, $response->getStatus());
84  $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
85 
86  $obj = VObject\Reader::read($response->body);
87 
88  $this->assertEquals(8, count($obj->children()));
89  $this->assertEquals(1, count($obj->VERSION));
90  $this->assertEquals(1, count($obj->CALSCALE));
91  $this->assertEquals(1, count($obj->PRODID));
92  $this->assertTrue(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
93  $this->assertEquals(1, count($obj->VTIMEZONE));
94  $this->assertEquals(1, count($obj->VEVENT));
95  $this->assertEquals("Hello!", $obj->{"X-WR-CALNAME"});
96  $this->assertEquals("#AA0000FF", $obj->{"X-APPLE-CALENDAR-COLOR"});
97 
98  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testBeforeMethodNoExport()

Sabre\CalDAV\ICSExportPluginTest::testBeforeMethodNoExport ( )

Definition at line 124 of file ICSExportPluginTest.php.

References $request, and $response.

124  {
125 
126  $request = new HTTP\Request(
127  'GET',
128  '/calendars/admin/UUID-123467'
129  );
130  $response = new HTTP\Response();
131  $this->assertNull($this->icsExportPlugin->httpGet($request, $response));
132 
133  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$response

◆ testBeforeMethodNoVersion()

Sabre\CalDAV\ICSExportPluginTest::testBeforeMethodNoVersion ( )

Definition at line 99 of file ICSExportPluginTest.php.

References Sabre\DAV\Server\$exposeVersion, $request, $response, Sabre\VObject\Reader\read(), Sabre\DAVServerTest\request(), and Sabre\DAV\Version\VERSION.

99  {
100 
101  $request = new HTTP\Request(
102  'GET',
103  '/calendars/admin/UUID-123467?export'
104  );
106  $response = $this->request($request);
108 
109  $this->assertEquals(200, $response->getStatus());
110  $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
111 
112  $obj = VObject\Reader::read($response->body);
113 
114  $this->assertEquals(8, count($obj->children()));
115  $this->assertEquals(1, count($obj->VERSION));
116  $this->assertEquals(1, count($obj->CALSCALE));
117  $this->assertEquals(1, count($obj->PRODID));
118  $this->assertFalse(strpos((string)$obj->PRODID, DAV\Version::VERSION) !== false);
119  $this->assertEquals(1, count($obj->VTIMEZONE));
120  $this->assertEquals(1, count($obj->VEVENT));
121 
122  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
static $exposeVersion
Definition: Server.php:184
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testContentDisposition()

Sabre\CalDAV\ICSExportPluginTest::testContentDisposition ( )

Definition at line 327 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

327  {
328 
329  $request = new HTTP\Request(
330  'GET',
331  '/calendars/admin/UUID-123467?export'
332  );
333 
334  $response = $this->request($request, 200);
335  $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
336  $this->assertEquals(
337  'attachment; filename="UUID-123467-' . date('Y-m-d') . '.ics"',
338  $response->getHeader('Content-Disposition')
339  );
340 
341  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testContentDispositionBadChars()

Sabre\CalDAV\ICSExportPluginTest::testContentDispositionBadChars ( )

Definition at line 360 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

360  {
361 
362  $this->caldavBackend->createCalendar(
363  'principals/admin',
364  'UUID-b_ad"(ch)ars',
365  [
366  '{DAV:}displayname' => 'Test bad characters',
367  '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF',
368  ]
369  );
370 
371  $request = new HTTP\Request(
372  'GET',
373  '/calendars/admin/UUID-b_ad"(ch)ars?export',
374  ['Accept' => 'application/calendar+json']
375  );
376 
377  $response = $this->request($request, 200);
378  $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
379  $this->assertEquals(
380  'attachment; filename="UUID-b_adchars-' . date('Y-m-d') . '.json"',
381  $response->getHeader('Content-Disposition')
382  );
383 
384  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testContentDispositionJson()

Sabre\CalDAV\ICSExportPluginTest::testContentDispositionJson ( )

Definition at line 343 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

343  {
344 
345  $request = new HTTP\Request(
346  'GET',
347  '/calendars/admin/UUID-123467?export',
348  ['Accept' => 'application/calendar+json']
349  );
350 
351  $response = $this->request($request, 200);
352  $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
353  $this->assertEquals(
354  'attachment; filename="UUID-123467-' . date('Y-m-d') . '.json"',
355  $response->getHeader('Content-Disposition')
356  );
357 
358  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testExpand()

Sabre\CalDAV\ICSExportPluginTest::testExpand ( )

Definition at line 230 of file ICSExportPluginTest.php.

References $request, $response, Sabre\VObject\Reader\read(), and Sabre\DAVServerTest\request().

230  {
231 
232  $request = new HTTP\Request(
233  'GET',
234  '/calendars/admin/UUID-123467?export&start=1&end=2000000000&expand=1'
235  );
236  $response = $this->request($request, 200);
237 
238  $obj = VObject\Reader::read($response->getBody());
239 
240  $this->assertEquals(0, count($obj->VTIMEZONE));
241  $this->assertEquals(1, count($obj->VEVENT));
242 
243  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testExpandNoStart()

Sabre\CalDAV\ICSExportPluginTest::testExpandNoStart ( )

Definition at line 220 of file ICSExportPluginTest.php.

References $request, and Sabre\DAVServerTest\request().

220  {
221 
222  $request = new HTTP\Request(
223  'GET',
224  '/calendars/admin/UUID-123467?export&expand=1&end=2'
225  );
226  $this->request($request, 400);
227 
228  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
+ Here is the call graph for this function:

◆ testFilterComponentBadComponent()

Sabre\CalDAV\ICSExportPluginTest::testFilterComponentBadComponent ( )

Definition at line 316 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

316  {
317 
318  $request = new HTTP\Request(
319  'GET',
320  '/calendars/admin/UUID-123467?export&componentType=VVOODOO'
321  );
322 
323  $response = $this->request($request, 400);
324 
325  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testFilterComponentVEVENT()

Sabre\CalDAV\ICSExportPluginTest::testFilterComponentVEVENT ( )

Definition at line 283 of file ICSExportPluginTest.php.

References $request, $response, Sabre\VObject\Reader\read(), and Sabre\DAVServerTest\request().

283  {
284 
285  $request = new HTTP\Request(
286  'GET',
287  '/calendars/admin/UUID-123467?export&componentType=VEVENT'
288  );
289 
290  $response = $this->request($request, 200);
291 
292  $obj = VObject\Reader::read($response->body);
293  $this->assertEquals(1, count($obj->VTIMEZONE));
294  $this->assertEquals(1, count($obj->VEVENT));
295  $this->assertEquals(0, count($obj->VTODO));
296 
297  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testFilterComponentVTODO()

Sabre\CalDAV\ICSExportPluginTest::testFilterComponentVTODO ( )

Definition at line 299 of file ICSExportPluginTest.php.

References $request, $response, Sabre\VObject\Reader\read(), and Sabre\DAVServerTest\request().

299  {
300 
301  $request = new HTTP\Request(
302  'GET',
303  '/calendars/admin/UUID-123467?export&componentType=VTODO'
304  );
305 
306  $response = $this->request($request, 200);
307 
308  $obj = VObject\Reader::read($response->body);
309 
310  $this->assertEquals(0, count($obj->VTIMEZONE));
311  $this->assertEquals(0, count($obj->VEVENT));
312  $this->assertEquals(1, count($obj->VTODO));
313 
314  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testFilterStartEnd()

Sabre\CalDAV\ICSExportPluginTest::testFilterStartEnd ( )

Definition at line 205 of file ICSExportPluginTest.php.

References $request, $response, Sabre\VObject\Reader\read(), and Sabre\DAVServerTest\request().

205  {
206 
207  $request = new HTTP\Request(
208  'GET',
209  '/calendars/admin/UUID-123467?export&start=1&end=2'
210  );
211  $response = $this->request($request, 200);
212 
213  $obj = VObject\Reader::read($response->getBody());
214 
215  $this->assertEquals(0, count($obj->VTIMEZONE));
216  $this->assertEquals(0, count($obj->VEVENT));
217 
218  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testInit()

Sabre\CalDAV\ICSExportPluginTest::testInit ( )

Definition at line 63 of file ICSExportPluginTest.php.

63  {
64 
65  $this->assertEquals(
66  $this->icsExportPlugin,
67  $this->server->getPlugin('ics-export')
68  );
69  $this->assertEquals($this->icsExportPlugin, $this->server->getPlugin('ics-export'));
70  $this->assertEquals('ics-export', $this->icsExportPlugin->getPluginInfo()['name']);
71 
72  }

◆ testJCal()

Sabre\CalDAV\ICSExportPluginTest::testJCal ( )

Definition at line 245 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

245  {
246 
247  $request = new HTTP\Request(
248  'GET',
249  '/calendars/admin/UUID-123467?export',
250  ['Accept' => 'application/calendar+json']
251  );
252 
253  $response = $this->request($request, 200);
254  $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
255 
256  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testJCalInUrl()

Sabre\CalDAV\ICSExportPluginTest::testJCalInUrl ( )

Definition at line 258 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

258  {
259 
260  $request = new HTTP\Request(
261  'GET',
262  '/calendars/admin/UUID-123467?export&accept=jcal'
263  );
264 
265  $response = $this->request($request, 200);
266  $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type'));
267 
268  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testNegotiateDefault()

Sabre\CalDAV\ICSExportPluginTest::testNegotiateDefault ( )

Definition at line 270 of file ICSExportPluginTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

270  {
271 
272  $request = new HTTP\Request(
273  'GET',
274  '/calendars/admin/UUID-123467?export',
275  ['Accept' => 'text/plain']
276  );
277 
278  $response = $this->request($request, 200);
279  $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
280 
281  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

Field Documentation

◆ $icsExportPlugin

Sabre\CalDAV\ICSExportPluginTest::$icsExportPlugin
protected

Definition at line 14 of file ICSExportPluginTest.php.

◆ $setupCalDAV

Sabre\CalDAV\ICSExportPluginTest::$setupCalDAV = true
protected

Definition at line 12 of file ICSExportPluginTest.php.


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