calendaring/php
Thomas Brüderli
bruederli at kolabsys.com
Fri Feb 28 15:59:44 CET 2014
calendaring/php/test.php | 100 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 100 insertions(+)
New commits:
commit 04b947664dd4b3e55b6c1622b0b6816ae27b696e
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Feb 20 07:17:58 2014 -0500
Add test case for recurrence computation from RDATE properties
diff --git a/calendaring/php/test.php b/calendaring/php/test.php
index 5582f88..c31bc6f 100644
--- a/calendaring/php/test.php
+++ b/calendaring/php/test.php
@@ -97,6 +97,79 @@ $xml = <<<EOF
</icalendar>
EOF;
+$rdates = <<<EOF
+<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
+ <vcalendar>
+ <properties>
+ <prodid>
+ <text>Roundcube-libkolab-0.9 Libkolabxml-1.1</text>
+ </prodid>
+ <version>
+ <text>2.0</text>
+ </version>
+ <x-kolab-version>
+ <text>3.1.0</text>
+ </x-kolab-version>
+ </properties>
+ <components>
+ <vevent>
+ <properties>
+ <uid>
+ <text>49961C572093EC3FC125799C004A200F-Lotus_Notes_Generated</text>
+ </uid>
+ <created>
+ <date-time>2014-02-28T12:57:42Z</date-time>
+ </created>
+ <dtstamp>
+ <date-time>2014-02-28T12:57:42Z</date-time>
+ </dtstamp>
+ <sequence>
+ <integer>0</integer>
+ </sequence>
+ <class>
+ <text>PUBLIC</text>
+ </class>
+ <dtstart>
+ <parameters>
+ <tzid>
+ <text>/kolab.org/Europe/Amsterdam</text>
+ </tzid>
+ </parameters>
+ <date-time>2012-03-30T04:00:00</date-time>
+ </dtstart>
+ <dtend>
+ <parameters>
+ <tzid>
+ <text>/kolab.org/Europe/Amsterdam</text>
+ </tzid>
+ </parameters>
+ <date-time>2012-03-30T20:00:00</date-time>
+ </dtend>
+ <transp>
+ <text>TRANSPARENT</text>
+ </transp>
+ <rdate>
+ <date>2012-03-30</date>
+ <date>2013-03-30</date>
+ <date>2014-03-30</date>
+ <date>2015-03-30</date>
+ <date>2016-03-30</date>
+ <date>2017-03-30</date>
+ <date>2018-03-30</date>
+ <date>2019-03-30</date>
+ <date>2020-03-30</date>
+ <date>2021-03-30</date>
+ </rdate>
+ <summary>
+ <text>Geburtstag Jane Doe (30.03.1969)</text>
+ </summary>
+ </properties>
+ </vevent>
+ </components>
+ </vcalendar>
+</icalendar>
+EOF;
+
$e = kolabformat::readEvent($xml, false);
$ec = new EventCal($e);
@@ -131,6 +204,33 @@ assertequal(
"EventCal::getLastOccurence"
);
+// test event with RDATE list
+
+$e = kolabformat::readEvent($rdates, false);
+$ec = new EventCal($e);
+
+$rstart = new cDateTime(2012,3,1, 0,0,0);
+$next = new cDateTime($ec->getNextOccurence($rstart));
+assertequal(
+ sprintf("%d-%02d-%02d %02d:%02d:%02d", $next->year(), $next->month(), $next->day(), $next->hour(), $next->minute(), $next->second()),
+ "2012-03-30 04:00:00",
+ "RDATE first recurrence"
+);
+
+$next = new cDateTime($ec->getNextOccurence($next));
+assertequal(
+ sprintf("%d-%02d-%02d %02d:%02d:%02d", $next->year(), $next->month(), $next->day(), $next->hour(), $next->minute(), $next->second()),
+ "2013-03-30 04:00:00",
+ "RDATE next recurrence"
+);
+
+$last = new cDateTime($ec->getLastOccurrence());
+assertequal(
+ sprintf("%d-%02d-%d %02d:%02d:%02d", $last->year(), $last->month(), $last->day(), $last->hour(), $last->minute(), $last->second()),
+ "2021-03-30 04:00:00",
+ "RDATE last occurence"
+);
+
// terminate with error status
exit($errors);
More information about the commits
mailing list