</summary> </properties> </vevent> </components> </vcalendar> </icalendar> EOF; $e = kolabformat::readEvent($xml, false); $ec = new EventCal($e); $rstart = new cDateTime(2012, 8, 1, 0, 0, 0); # asserttrue($ec->getNextOccurence($rstart) instanceof cDateTime, "EventCal::getNextOccurence() returning cDateTime instance"); $next = new cDateTime($ec->getNextOccurence($rstart)); assertequal(sprintf("%d-%d-%d %02d:%02d:%02d", $next->year(), $next->month(), $next->day(), $next->hour(), $next->minute(), $next->second()), "2012-10-23 14:00:00", "EventCal first recurrence"); $next = new cDateTime($ec->getNextOccurence($next)); assertequal(sprintf("%d-%d-%d %02d:%02d:%02d", $next->year(), $next->month(), $next->day(), $next->hour(), $next->minute(), $next->second()), "2012-10-25 14:00:00", "EventCal second recurrence"); $end = new cDateTime($ec->getOccurenceEndDate($next)); assertequal(sprintf("%d-%d-%d %02d:%02d:%02d", $end->year(), $end->month(), $end->day(), $end->hour(), $end->minute(), $end->second()), "2012-10-25 15:30:00", "EventCal::getOccurenceEndDate"); $last = new cDateTime($ec->getLastOccurrence()); assertequal(sprintf("%d-%d-%d %02d:%02d:%02d", $last->year(), $last->month(), $last->day(), $last->hour(), $last->minute(), $last->second()), "2012-10-29 14:00:00", "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);