summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-02-20 12:17:58 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-02-20 12:17:58 (GMT)
commit04b947664dd4b3e55b6c1622b0b6816ae27b696e (patch)
tree31825c80a2a944adc366ea980389a5b4f0fcf1ae
parent65eb2db198f81175f3ec2665f46d717f5a9a4c33 (diff)
downloadlibkolab-04b947664dd4b3e55b6c1622b0b6816ae27b696e.tar.gz
Add test case for recurrence computation from RDATE properties
-rw-r--r--calendaring/php/test.php100
1 files changed, 100 insertions, 0 deletions
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);