summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas B <roundcube@gmail.com>2012-04-03 08:00:26 (GMT)
committerThomas B <roundcube@gmail.com>2012-04-03 08:00:26 (GMT)
commit76a97d6665e5c6c671aa0016f832afea4f2a9dfc (patch)
tree9007e132d1d1c0232a636d4212b30a9ed13f59f7
parentdf09a3cd73cf73bcaac45a4dc3f23776d066a04e (diff)
downloadlibkolabxml-76a97d6665e5c6c671aa0016f832afea4f2a9dfc.tar.gz
Add more tests for PHP bindings
-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..3c6d891 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