mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-15 06:53:59 +00:00
86 lines
2.5 KiB
PHP
86 lines
2.5 KiB
PHP
<?php
|
|
|
|
class Sabre_CalDAV_Backend_AbstractTest extends PHPUnit_Framework_TestCase {
|
|
|
|
function testUpdateCalendar() {
|
|
|
|
$abstract = new Sabre_CalDAV_Backend_AbstractMock();
|
|
$this->assertEquals(false, $abstract->updateCalendar('randomid', array('{DAV:}displayname' => 'anything')));
|
|
|
|
}
|
|
|
|
function testCalendarQuery() {
|
|
|
|
$abstract = new Sabre_CalDAV_Backend_AbstractMock();
|
|
$filters = array(
|
|
'name' => 'VCALENDAR',
|
|
'comp-filters' => array(
|
|
array(
|
|
'name' => 'VEVENT',
|
|
'comp-filters' => array(),
|
|
'prop-filters' => array(),
|
|
'is-not-defined' => false,
|
|
'time-range' => null,
|
|
),
|
|
),
|
|
'prop-filters' => array(),
|
|
'is-not-defined' => false,
|
|
'time-range' => null,
|
|
);
|
|
|
|
$this->assertEquals(array(
|
|
'event1.ics',
|
|
), $abstract->calendarQuery(1, $filters));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class Sabre_CalDAV_Backend_AbstractMock extends Sabre_CalDAV_Backend_Abstract {
|
|
|
|
function getCalendarsForUser($principalUri) { }
|
|
function createCalendar($principalUri,$calendarUri,array $properties) { }
|
|
function deleteCalendar($calendarId) { }
|
|
function getCalendarObjects($calendarId) {
|
|
|
|
return array(
|
|
array(
|
|
'id' => 1,
|
|
'calendarid' => 1,
|
|
'uri' => 'event1.ics',
|
|
),
|
|
array(
|
|
'id' => 2,
|
|
'calendarid' => 1,
|
|
'uri' => 'task1.ics',
|
|
),
|
|
);
|
|
|
|
}
|
|
function getCalendarObject($calendarId,$objectUri) {
|
|
|
|
switch($objectUri) {
|
|
|
|
case 'event1.ics' :
|
|
return array(
|
|
'id' => 1,
|
|
'calendarid' => 1,
|
|
'uri' => 'event1.ics',
|
|
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
|
|
);
|
|
case 'task1.ics' :
|
|
return array(
|
|
'id' => 1,
|
|
'calendarid' => 1,
|
|
'uri' => 'event1.ics',
|
|
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n",
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
function createCalendarObject($calendarId,$objectUri,$calendarData) { }
|
|
function updateCalendarObject($calendarId,$objectUri,$calendarData) { }
|
|
function deleteCalendarObject($calendarId,$objectUri) { }
|
|
|
|
}
|