mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 10:28:50 +00:00
Exporting and Importing ICS-Files
This commit is contained in:
parent
a96c8ce670
commit
66384e2e2c
16 changed files with 245 additions and 47 deletions
|
@ -343,6 +343,14 @@ DURATION:PT1H
|
|||
RRULE:FREQ=YEARLY
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
yow;
|
||||
$blob33 = <<<yow
|
||||
BEGIN:VCALENDAR
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20120628
|
||||
RRULE:FREQ=DAILY
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
yow;
|
||||
|
||||
$filter1 = array(
|
||||
|
@ -604,8 +612,16 @@ yow;
|
|||
'time-range' => null,
|
||||
);
|
||||
|
||||
// Time-range with RRULE
|
||||
|
||||
$filter38 = array(
|
||||
'name' => 'VEVENT',
|
||||
'comp-filters' => array(),
|
||||
'prop-filters' => array(),
|
||||
'is-not-defined' => false,
|
||||
'time-range' => array(
|
||||
'start' => new DateTime('2012-07-01 00:00:00', new DateTimeZone('UTC')),
|
||||
'end' => new DateTime('2012-08-01 00:00:00', new DateTimeZone('UTC')),
|
||||
)
|
||||
);
|
||||
|
||||
return array(
|
||||
// Component check
|
||||
|
@ -741,6 +757,9 @@ yow;
|
|||
array($blob31, $filter20, 1),
|
||||
array($blob32, $filter20, 0),
|
||||
|
||||
// Bug reported on mailing list, related to all-day events.
|
||||
array($blob33, $filter38, 1),
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -53,9 +53,14 @@ class Sabre_VObject_Component_VEventTest extends PHPUnit_Framework_TestCase {
|
|||
$vevent6->DTEND['VALUE'] = 'DATE';
|
||||
$tests[] = array($vevent6, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true);
|
||||
$tests[] = array($vevent6, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false);
|
||||
// Event with no end date should be treated as lasting the entire day.
|
||||
$tests[] = array($vevent6, new DateTime('2011-12-25 16:00:00'), new DateTime('2011-12-25 17:00:00'), true);
|
||||
|
||||
// Added this test to ensure that recurrence rules with no DTEND also
|
||||
// get checked for the entire day.
|
||||
$vevent7 = clone $vevent;
|
||||
$vevent7->DTSTART = '20120101';
|
||||
$vevent7->DTSTART['VALUE'] = 'DATE';
|
||||
$vevent7->RRULE = 'FREQ=MONTHLY';
|
||||
$tests[] = array($vevent7, new DateTime('2012-02-01 15:00:00'), new DateTime('2012-02-02'), true);
|
||||
return $tests;
|
||||
|
||||
}
|
||||
|
|
|
@ -707,6 +707,51 @@ class Sabre_VObject_RecurrenceIteratorTest extends PHPUnit_Framework_TestCase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testValues
|
||||
*/
|
||||
function testYearlyLeapYear() {
|
||||
|
||||
$ev = new Sabre_VObject_Component('VEVENT');
|
||||
$ev->UID = 'bla';
|
||||
$ev->RRULE = 'FREQ=YEARLY;COUNT=3';
|
||||
$dtStart = new Sabre_VObject_Property_DateTime('DTSTART');
|
||||
$dtStart->setDateTime(new DateTime('2012-02-29'),Sabre_VObject_Property_DateTime::UTC);
|
||||
|
||||
$ev->add($dtStart);
|
||||
|
||||
$vcal = Sabre_VObject_Component::create('VCALENDAR');
|
||||
$vcal->add($ev);
|
||||
|
||||
$it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid);
|
||||
|
||||
$this->assertEquals('yearly', $it->frequency);
|
||||
$this->assertEquals(3, $it->count);
|
||||
|
||||
$max = 20;
|
||||
$result = array();
|
||||
foreach($it as $k=>$item) {
|
||||
|
||||
$result[] = $item;
|
||||
$max--;
|
||||
|
||||
if (!$max) break;
|
||||
|
||||
}
|
||||
|
||||
$tz = new DateTimeZone('UTC');
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
new DateTime('2012-02-29', $tz),
|
||||
new DateTime('2016-02-29', $tz),
|
||||
new DateTime('2020-02-29', $tz),
|
||||
),
|
||||
$result
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testValues
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue