コード例 #1
0
          </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);
コード例 #2
0
$b->setName("Member-B");
$m->push($b);
#$c = new ContactReference(ContactReference::EmailAndUidReference, "c@localhost", "dddaab06-0000-0000-eeb5-cc64ff7f0000");
#$c->setName("Member-C");
#$m->push($c);
assertequal($m->size(), 2, "vectorcontactref::size()");
$dl->setMembers($m);
$xml = kolabformat::writeDistlist($dl);
#print $xml;
assertcontains($xml, '<fn><text>DalistÄÖŸ</text></fn>', "kolabformat::writeDistlist(): FN (UTF-8)");
assertcontains($xml, '<uri>mailto:Member-A%3Ca%40localhost%3E</uri>', "kolabformat::writeDistlist(): mailto uri");
assertcontains($xml, '<member><uri>urn:uuid:x-member-b-fff</uri>', "kolabformat::writeDistlist(): member urn::uuid");
/////// Test Configuration.Dictionary
$d = new Dictionary('de');
$d->setEntries(array2vector(array('Kolab', 'Roundcube', 'libkolabxml')));
$c = new Configuration($d);
$xml = kolabformat::writeConfiguration($c);
#print $xml;
$c2 = kolabformat::readConfiguration($xml, false);
$d2 = $c2->dictionary();
assertequal($d2->language(), 'de', "Configuration.Dictionary::language");
assertequal($d2->entries()->size(), 3, "Dictionary::entries()");
$d = new Dictionary('en');
$d->setEntries(array2vector(array('Kolab', 'Roundcube', 'libkolabxml')));
$c = new Configuration($d);
$xml = kolabformat::writeConfiguration($c);
#print $xml;
$c3 = kolabformat::readConfiguration($xml, false);
asserttrue($c2->uid() != $c3->uid(), "Generate different UIDs for configuration objects");
// terminate with error status
exit($errors);