summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-04 09:44:19 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-04-04 09:44:19 (GMT)
commit625376142619ea7a4ffc805b73b8212ef46e25de (patch)
tree853d245a390bffae9f5defb7454cafb3577b5938
parent6151110b14191d4a9050989a6ed13e243a287cba (diff)
parent1e243a20d6d2850165e0b0b7301fa775d36adc27 (diff)
downloadlibkolabxml-625376142619ea7a4ffc805b73b8212ef46e25de.tar.gz
Merge branch 'master' of ssh://git.kolab.org/git/libkolabxml
-rwxr-xr-xsrc/php/test.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/php/test.php b/src/php/test.php
index 75f7d9f..557cba2 100755
--- a/src/php/test.php
+++ b/src/php/test.php
@@ -59,6 +59,17 @@ $bysec->push(3);
$r->setBySecond($bysec);
$e->setRecurrenceRule($r);
+$va = new vectoralarm;
+$a1 = new Alarm("Display alarm");
+$a1->setRelativeStart(new Duration(0, 6, 30, 0, true), kolabformat::Start);
+$va->push($a1);
+$acr = new vectorcontactref;
+$acr->push(new ContactReference("alarms@kolab.org"));
+$a2 = new Alarm("Email alarm", "Alarm description", $acr);
+$a2->setStart(new cDateTime(2012,7,30, 20, 30, 0));
+$va->push($a2);
+$e->setAlarms($va);
+
$xml = kolabformat::writeEvent($e);
#print $xml;
assertcontains($xml, '<dtstart><date>2012-07-31</date></dtstart>', "Event::setStart() with date only");
@@ -66,6 +77,11 @@ assertcontains($xml, '<created><date-time>2012-03-14T09:05:30Z</date-time></crea
assertcontains($xml, '<rrule><recur><freq>MINUTELY</freq>', "RecurrenceRule::setFrequency()");
assertcontains($xml, '<rrule><recur><freq>MINUTELY</freq><bysecond>1</bysecond><bysecond>3</bysecond></recur></rrule>', "RecurrenceRule::setBySecond()");
assertcontains($xml, '<exdate><date>2009-10-12</date></exdate>', "Event Recurrence Exceptions");
+assertcontains($xml, '<duration>-PT6H30M</duration>', "Alarm::setRelativeStart(Duration)");
+assertcontains($xml, '<trigger><date-time>2012-07-30T20:30:00Z</date-time>', "Alarm::setStart()");
+assertcontains($xml, '<trigger><parameters><related><text>START</text>', "Alarm relative to Start");
+assertcontains($xml, '<valarm><properties><action><text>EMAIL</text>', "Email alarm");
+assertcontains($xml, '<attendee><cal-address>mailto:%3Calarms%40kolab%2Eorg%3E</cal-address>', "Email alarm attendee");
$e1 = kolabformat::readEvent($xml, false);
assertequal($xml, kolabformat::writeEvent($e1), "kolabformat::readEvent() => kolabformat::writeEvent()");
@@ -78,6 +94,18 @@ assertequal($r->frequency(), RecurrenceRule::Minutely, "RecurrenceRule::frequenc
assertequal($r->bysecond()->size(), 2, "RecurrenceRule::bysecond()");
assertequal($e1->exceptionDates()->size(), 1, "Read Event::exceptionDates()");
+$rr = new RecurrenceRule();
+$rr->setFrequency(RecurrenceRule::Monthly);
+$byday = new vectordaypos;
+$byday->push(new DayPos(2, kolabformat::Monday));
+$byday->push(new DayPos(-1, kolabformat::Friday));
+$rr->setByday($byday);
+$e1->setRecurrenceRule($rr);
+$xml = kolabformat::writeEvent($e1);
+#print $xml;
+assertcontains($xml, '<byday>2MO</byday><byday>-1FR</byday>', "Recurrence by weekday");
+
+
/////// Test Contact