mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-08 17:38:49 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
115
dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
Normal file
115
dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
class Sabre_CalDAV_CalendarQueryVAlarmTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* This test is specifically for a time-range query on a VALARM, contained
|
||||
* in a VEVENT that's recurring
|
||||
*/
|
||||
function testValarm() {
|
||||
|
||||
$vevent = Sabre_VObject_Component::create('VEVENT');
|
||||
$vevent->RRULE = 'FREQ=MONTHLY';
|
||||
$vevent->DTSTART = '20120101T120000Z';
|
||||
$vevent->UID = 'bla';
|
||||
|
||||
$valarm = Sabre_VObject_Component::create('VALARM');
|
||||
$valarm->TRIGGER = '-P15D';
|
||||
$vevent->add($valarm);
|
||||
|
||||
$vcalendar = Sabre_VObject_Component::create('VCALENDAR');
|
||||
$vcalendar->add($vevent);
|
||||
|
||||
$filter = array(
|
||||
'name' => 'VCALENDAR',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(
|
||||
array(
|
||||
'name' => 'VEVENT',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(
|
||||
array(
|
||||
'name' => 'VALARM',
|
||||
'is-not-defined' => false,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(),
|
||||
'time-range' => array(
|
||||
'start' => new DateTime('2012-05-10'),
|
||||
'end' => new DateTime('2012-05-20'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$validator = new Sabre_CalDAV_CalendarQueryValidator();
|
||||
$this->assertTrue($validator->validate($vcalendar, $filter));
|
||||
|
||||
|
||||
// A limited recurrence rule, should return false
|
||||
$vevent = Sabre_VObject_Component::create('VEVENT');
|
||||
$vevent->RRULE = 'FREQ=MONTHLY;COUNT=1';
|
||||
$vevent->DTSTART = '20120101T120000Z';
|
||||
$vevent->UID = 'bla';
|
||||
|
||||
$valarm = Sabre_VObject_Component::create('VALARM');
|
||||
$valarm->TRIGGER = '-P15D';
|
||||
$vevent->add($valarm);
|
||||
|
||||
$vcalendar = Sabre_VObject_Component::create('VCALENDAR');
|
||||
$vcalendar->add($vevent);
|
||||
|
||||
$this->assertFalse($validator->validate($vcalendar, $filter));
|
||||
}
|
||||
|
||||
function testAlarmWayBefore() {
|
||||
|
||||
$vevent = Sabre_VObject_Component::create('VEVENT');
|
||||
$vevent->DTSTART = '20120101T120000Z';
|
||||
$vevent->UID = 'bla';
|
||||
|
||||
$valarm = Sabre_VObject_Component::create('VALARM');
|
||||
$valarm->TRIGGER = '-P2W1D';
|
||||
$vevent->add($valarm);
|
||||
|
||||
$vcalendar = Sabre_VObject_Component::create('VCALENDAR');
|
||||
$vcalendar->add($vevent);
|
||||
|
||||
$filter = array(
|
||||
'name' => 'VCALENDAR',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(
|
||||
array(
|
||||
'name' => 'VEVENT',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(
|
||||
array(
|
||||
'name' => 'VALARM',
|
||||
'is-not-defined' => false,
|
||||
'prop-filters' => array(),
|
||||
'comp-filters' => array(),
|
||||
'time-range' => array(
|
||||
'start' => new DateTime('2011-12-10'),
|
||||
'end' => new DateTime('2011-12-20'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$validator = new Sabre_CalDAV_CalendarQueryValidator();
|
||||
$this->assertTrue($validator->validate($vcalendar, $filter));
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue