]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Backend/AbstractTest.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Backend / AbstractTest.php
1 <?php
2
3 class Sabre_CalDAV_Backend_AbstractTest extends PHPUnit_Framework_TestCase {
4
5     function testUpdateCalendar() {
6
7         $abstract = new Sabre_CalDAV_Backend_AbstractMock();
8         $this->assertEquals(false, $abstract->updateCalendar('randomid', array('{DAV:}displayname' => 'anything')));
9
10     }
11
12     function testCalendarQuery() {
13
14         $abstract = new Sabre_CalDAV_Backend_AbstractMock();
15         $filters = array(
16             'name' => 'VCALENDAR',
17             'comp-filters' => array(
18                 array(
19                     'name' => 'VEVENT',
20                     'comp-filters' => array(),
21                     'prop-filters' => array(),
22                     'is-not-defined' => false,
23                     'time-range' => null,
24                 ),
25             ),
26             'prop-filters' => array(),
27             'is-not-defined' => false,
28             'time-range' => null,
29         );
30
31         $this->assertEquals(array(
32             'event1.ics',
33         ), $abstract->calendarQuery(1, $filters));
34
35     }
36
37 }
38
39 class Sabre_CalDAV_Backend_AbstractMock extends Sabre_CalDAV_Backend_Abstract {
40
41     function getCalendarsForUser($principalUri) { }
42     function createCalendar($principalUri,$calendarUri,array $properties) { }
43     function deleteCalendar($calendarId) { }
44     function getCalendarObjects($calendarId) { 
45
46         return array(
47             array(
48                 'id' => 1,
49                 'calendarid' => 1,
50                 'uri' => 'event1.ics',
51             ),
52             array(
53                 'id' => 2,
54                 'calendarid' => 1,
55                 'uri' => 'task1.ics',
56             ),
57         );
58
59     }
60     function getCalendarObject($calendarId,$objectUri) { 
61
62         switch($objectUri) {
63
64             case 'event1.ics' :
65                 return array(
66                     'id' => 1,
67                     'calendarid' => 1,
68                     'uri' => 'event1.ics',
69                     'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
70                 );
71             case 'task1.ics' :
72                 return array(
73                     'id' => 1,
74                     'calendarid' => 1,
75                     'uri' => 'event1.ics',
76                     'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n",
77                 );
78
79         }
80
81     }
82     function createCalendarObject($calendarId,$objectUri,$calendarData) { }
83     function updateCalendarObject($calendarId,$objectUri,$calendarData) { }
84     function deleteCalendarObject($calendarId,$objectUri) { }
85
86 }