コード例 #1
0
ファイル: EnumTest.php プロジェクト: nucleus-be/zimbra-api
 public function testAlarmAction()
 {
     $values = array('DISPLAY', 'AUDIO', 'EMAIL', 'PROCEDURE', 'X_YAHOO_CALENDAR_ACTION_IM', 'X_YAHOO_CALENDAR_ACTION_MOBILE');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\AlarmAction::has($value));
     }
 }
コード例 #2
0
 public function testInviteComponent()
 {
     $name = $this->faker->word;
     $value = $this->faker->word;
     $address = $this->faker->word;
     $url = $this->faker->word;
     $displayName = $this->faker->word;
     $sentBy = $this->faker->word;
     $dir = $this->faker->word;
     $lang = $this->faker->word;
     $cutype = $this->faker->word;
     $role = $this->faker->word;
     $member = $this->faker->word;
     $delTo = $this->faker->word;
     $delFrom = $this->faker->word;
     $date = $this->faker->iso8601;
     $uri = $this->faker->word;
     $ct = $this->faker->word;
     $tz = $this->faker->word;
     $utc = mt_rand(0, 24);
     $rangeType = mt_rand(1, 10);
     $weeks = mt_rand(1, 7);
     $days = mt_rand(1, 30);
     $hours = mt_rand(0, 23);
     $minutes = mt_rand(0, 59);
     $seconds = mt_rand(0, 59);
     $related = $this->faker->randomElement(['START', 'END']);
     $ordwk = mt_rand(1, 54);
     $num = mt_rand(1, 1000);
     $quantity = mt_rand(5, 10);
     $numbers = self::randomRange(0, 59, $quantity);
     $seclist = $minlist = implode(',', $numbers);
     $numbers = self::randomRange(0, 23, $quantity);
     $hrlist = implode(',', $numbers);
     $numbers = self::randomRange(1, 31, $quantity);
     $modaylist = implode(',', $numbers);
     $numbers = self::randomRange(1, 366, $quantity);
     $yrdaylist = implode(',', $numbers);
     $numbers = self::randomRange(1, 53, $quantity);
     $wklist = implode(',', $numbers);
     $numbers = self::randomRange(1, 12, $quantity);
     $molist = implode(',', $numbers);
     $numbers = self::randomRange(1, 366, $quantity);
     $poslist = implode(',', $numbers);
     $lat = $this->faker->randomFloat;
     $lon = $this->faker->randomFloat;
     $desc = $this->faker->word;
     $summary = $this->faker->word;
     $method = $this->faker->word;
     $loc = $this->faker->word;
     $x_uid = $this->faker->uuid;
     $uid = $this->faker->uuid;
     $compNum = mt_rand(1, 10);
     $priority = mt_rand(1, 10);
     $percent = mt_rand(1, 100);
     $seq = mt_rand(1, 10);
     $d = mt_rand(1, 10);
     $calItemId = $this->faker->word;
     $apptId = $this->faker->word;
     $ciFolder = $this->faker->word;
     $ridZ = $this->faker->iso8601;
     $category = $this->faker->word;
     $comment = $this->faker->word;
     $contact = $this->faker->word;
     $fr = $this->faker->word;
     $descHtml = $this->faker->word;
     $xparam = new \Zimbra\Mail\Struct\XParam($name, $value);
     $at = new \Zimbra\Mail\Struct\CalendarAttendee($address, $url, $displayName, $sentBy, $dir, $lang, $cutype, $role, ParticipationStatus::NEEDS_ACTION(), true, $member, $delTo, $delFrom, [$xparam]);
     $abs = new \Zimbra\Mail\Struct\DateAttr($date);
     $rel = new \Zimbra\Mail\Struct\DurationInfo(true, $weeks, $days, $hours, $minutes, $seconds, $related, $num);
     $trigger = new \Zimbra\Mail\Struct\AlarmTriggerInfo($abs, $rel);
     $repeat = new \Zimbra\Mail\Struct\DurationInfo(false, $weeks, $days, $hours, $minutes, $seconds, $related, $num);
     $attach = new \Zimbra\Mail\Struct\CalendarAttach($uri, $ct, $value);
     $except = new \Zimbra\Mail\Struct\ExceptionRuleInfo($rangeType, $date, null, null, $tz, $ridZ);
     $cancel = new \Zimbra\Mail\Struct\CancelRuleInfo($rangeType, $date, $tz, $ridZ);
     $s = new \Zimbra\Mail\Struct\DtTimeInfo($date, $tz, $utc);
     $e = new \Zimbra\Mail\Struct\DtTimeInfo($date, $tz, $utc);
     $dur = new \Zimbra\Mail\Struct\DurationInfo(true, $weeks, $days, $hours, $minutes, $seconds, $related, $num);
     $dtval = new \Zimbra\Mail\Struct\DtVal($s, $e, $dur);
     $dates = new \Zimbra\Mail\Struct\SingleDates($tz, [$dtval]);
     $wkday = new \Zimbra\Mail\Struct\WkDay(WeekDay::SU(), $ordwk);
     $until = new \Zimbra\Mail\Struct\DateTimeStringAttr($date);
     $count = new \Zimbra\Mail\Struct\NumAttr($num);
     $interval = new \Zimbra\Mail\Struct\IntervalRule($num);
     $bysecond = new \Zimbra\Mail\Struct\BySecondRule($seclist);
     $byminute = new \Zimbra\Mail\Struct\ByMinuteRule($seclist);
     $byhour = new \Zimbra\Mail\Struct\ByHourRule($hrlist);
     $byday = new \Zimbra\Mail\Struct\ByDayRule([$wkday]);
     $bymonthday = new \Zimbra\Mail\Struct\ByMonthDayRule($modaylist);
     $byyearday = new \Zimbra\Mail\Struct\ByYearDayRule($yrdaylist);
     $byweekno = new \Zimbra\Mail\Struct\ByWeekNoRule($wklist);
     $bymonth = new \Zimbra\Mail\Struct\ByMonthRule($molist);
     $bysetpos = new \Zimbra\Mail\Struct\BySetPosRule($poslist);
     $wkst = new \Zimbra\Mail\Struct\WkstRule(WeekDay::SU());
     $xname = new \Zimbra\Mail\Struct\XNameRule($name, $value);
     $rule = new \Zimbra\Mail\Struct\SimpleRepeatingRule(Frequency::SECOND(), $until, $count, $interval, $bysecond, $byminute, $byhour, $byday, $bymonthday, $byyearday, $byweekno, $bymonth, $bysetpos, $wkst, [$xname]);
     $add = new \Zimbra\Mail\Struct\AddRecurrenceInfo([$except, $cancel, $dates, $rule]);
     $exclude = new \Zimbra\Mail\Struct\ExcludeRecurrenceInfo([$except, $cancel, $dates, $rule]);
     $geo = new \Zimbra\Mail\Struct\GeoInfo($lat, $lon);
     $xprop = new \Zimbra\Mail\Struct\XProp($name, $value, [$xparam]);
     $alarm = new \Zimbra\Mail\Struct\AlarmInfo(AlarmAction::DISPLAY(), $trigger, $repeat, $desc, $attach, $summary, [$at], [$xprop]);
     $org = new \Zimbra\Mail\Struct\CalOrganizer($address, $url, $displayName, $sentBy, $dir, $lang, [$xparam]);
     $recur = new \Zimbra\Mail\Struct\RecurrenceInfo([$add, $exclude, $except, $cancel, $dates, $rule]);
     $exceptId = new \Zimbra\Mail\Struct\ExceptionRecurIdInfo($date, $tz, RangeType::NONE());
     $comp = new \Zimbra\Mail\Struct\InviteComponent($method, $compNum, true, $priority, $name, $loc, $percent, $date, true, FreeBusyStatus::FREE(), FreeBusyStatus::FREE(), Transparency::OPAQUE(), true, $x_uid, $uid, $seq, $d, $calItemId, $apptId, $ciFolder, InviteStatus::COMPLETED(), InviteClass::PUB(), $url, true, $ridZ, true, true, true, [InviteChange::SUBJECT(), InviteChange::LOCATION(), InviteChange::TIME()], [$category], [$comment], [$contact], $geo, [$at], [$alarm], [$xprop], $fr, $desc, $descHtml, $org, $recur, $exceptId, $s, $e, $dur);
     $this->assertSame([$category], $comp->getCategories()->all());
     $this->assertSame([$comment], $comp->getComments()->all());
     $this->assertSame([$contact], $comp->getContacts()->all());
     $this->assertSame($geo, $comp->getGeo());
     $this->assertSame([$at], $comp->getAttendees()->all());
     $this->assertSame([$alarm], $comp->getAlarms()->all());
     $this->assertSame([$xprop], $comp->getXProps()->all());
     $this->assertSame($fr, $comp->getFragment());
     $this->assertSame($desc, $comp->getDescription());
     $this->assertSame($descHtml, $comp->getHtmlDescription());
     $this->assertSame($org, $comp->getOrganizer());
     $this->assertSame($recur, $comp->getRecurrence());
     $this->assertSame($exceptId, $comp->getExceptionId());
     $this->assertSame($s, $comp->getDtStart());
     $this->assertSame($e, $comp->getDtEnd());
     $this->assertSame($dur, $comp->getDuration());
     $comp->addCategory($category)->addComment($comment)->addContact($contact)->setGeo($geo)->addAttendee($at)->addAlarm($alarm)->addXProp($xprop)->setFragment($fr)->setDescription($desc)->setHtmlDescription($descHtml)->setOrganizer($org)->setRecurrence($recur)->setExceptionId($exceptId)->setDtStart($s)->setDtEnd($e)->setDuration($dur);
     $this->assertSame([$category, $category], $comp->getCategories()->all());
     $this->assertSame([$comment, $comment], $comp->getComments()->all());
     $this->assertSame([$contact, $contact], $comp->getContacts()->all());
     $this->assertSame($geo, $comp->getGeo());
     $this->assertSame([$at, $at], $comp->getAttendees()->all());
     $this->assertSame([$alarm, $alarm], $comp->getAlarms()->all());
     $this->assertSame([$xprop, $xprop], $comp->getXProps()->all());
     $this->assertSame($fr, $comp->getFragment());
     $this->assertSame($desc, $comp->getDescription());
     $this->assertSame($descHtml, $comp->getHtmlDescription());
     $this->assertSame($org, $comp->getOrganizer());
     $this->assertSame($recur, $comp->getRecurrence());
     $this->assertSame($exceptId, $comp->getExceptionId());
     $this->assertSame($s, $comp->getDtStart());
     $this->assertSame($e, $comp->getDtEnd());
     $this->assertSame($dur, $comp->getDuration());
     $comp = new \Zimbra\Mail\Struct\InviteComponent($method, $compNum, true, $priority, $name, $loc, $percent, $date, true, FreeBusyStatus::FREE(), FreeBusyStatus::FREE(), Transparency::OPAQUE(), true, $x_uid, $uid, $seq, $d, $calItemId, $apptId, $ciFolder, InviteStatus::COMPLETED(), InviteClass::PUB(), $url, true, $ridZ, true, true, true, [InviteChange::SUBJECT(), InviteChange::LOCATION(), InviteChange::TIME()], [$category], [$comment], [$contact], $geo, [$at], [$alarm], [$xprop], $fr, $desc, $descHtml, $org, $recur, $exceptId, $s, $e, $dur);
     $xml = '<?xml version="1.0"?>' . "\n" . '<comp' . ' method="' . $method . '"' . ' compNum="' . $compNum . '"' . ' rsvp="true"' . ' priority="' . $priority . '"' . ' name="' . $name . '"' . ' loc="' . $loc . '"' . ' percentComplete="' . $percent . '"' . ' completed="' . $date . '"' . ' noBlob="true"' . ' fba="' . FreeBusyStatus::FREE() . '"' . ' fb="' . FreeBusyStatus::FREE() . '"' . ' transp="' . Transparency::OPAQUE() . '"' . ' isOrg="true"' . ' x_uid="' . $x_uid . '"' . ' uid="' . $uid . '"' . ' seq="' . $seq . '"' . ' d="' . $d . '"' . ' calItemId="' . $calItemId . '"' . ' apptId="' . $apptId . '"' . ' ciFolder="' . $ciFolder . '"' . ' status="' . InviteStatus::COMPLETED() . '"' . ' class="' . InviteClass::PUB() . '"' . ' url="' . $url . '"' . ' ex="true"' . ' ridZ="' . $ridZ . '"' . ' allDay="true"' . ' draft="true"' . ' neverSent="true"' . ' changes="' . InviteChange::SUBJECT() . ',' . InviteChange::LOCATION() . ',' . InviteChange::TIME() . '">' . '<geo lat="' . $lat . '" lon="' . $lon . '" />' . '<fr>' . $fr . '</fr>' . '<desc>' . $desc . '</desc>' . '<descHtml>' . $descHtml . '</descHtml>' . '<or a="' . $address . '" url="' . $url . '" d="' . $displayName . '" sentBy="' . $sentBy . '" dir="' . $dir . '" lang="' . $lang . '">' . '<xparam name="' . $name . '" value="' . $value . '" />' . '</or>' . '<recur>' . '<add>' . '<except rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<cancel rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<dates tz="' . $tz . '">' . '<dtval>' . '<s d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<e d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<dur neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '</dtval>' . '</dates>' . '<rule freq="' . Frequency::SECOND() . '">' . '<until d="' . $date . '" />' . '<count num="' . $num . '" />' . '<interval ival="' . $num . '" />' . '<bysecond seclist="' . $seclist . '" />' . '<byminute minlist="' . $minlist . '" />' . '<byhour hrlist="' . $hrlist . '" />' . '<byday>' . '<wkday day="' . WeekDay::SU() . '" ordwk="' . $ordwk . '" />' . '</byday>' . '<bymonthday modaylist="' . $modaylist . '" />' . '<byyearday yrdaylist="' . $yrdaylist . '" />' . '<byweekno wklist="' . $wklist . '" />' . '<bymonth molist="' . $molist . '" />' . '<bysetpos poslist="' . $poslist . '" />' . '<wkst day="' . WeekDay::SU() . '" />' . '<rule-x-name name="' . $name . '" value="' . $value . '" />' . '</rule>' . '</add>' . '<exclude>' . '<except rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<cancel rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<dates tz="' . $tz . '">' . '<dtval>' . '<s d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<e d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<dur neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '</dtval>' . '</dates>' . '<rule freq="' . Frequency::SECOND() . '">' . '<until d="' . $date . '" />' . '<count num="' . $num . '" />' . '<interval ival="' . $num . '" />' . '<bysecond seclist="' . $seclist . '" />' . '<byminute minlist="' . $minlist . '" />' . '<byhour hrlist="' . $hrlist . '" />' . '<byday>' . '<wkday day="' . WeekDay::SU() . '" ordwk="' . $ordwk . '" />' . '</byday>' . '<bymonthday modaylist="' . $modaylist . '" />' . '<byyearday yrdaylist="' . $yrdaylist . '" />' . '<byweekno wklist="' . $wklist . '" />' . '<bymonth molist="' . $molist . '" />' . '<bysetpos poslist="' . $poslist . '" />' . '<wkst day="' . WeekDay::SU() . '" />' . '<rule-x-name name="' . $name . '" value="' . $value . '" />' . '</rule>' . '</exclude>' . '<except rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<cancel rangeType="' . $rangeType . '" recurId="' . $date . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '<dates tz="' . $tz . '">' . '<dtval>' . '<s d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<e d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<dur neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '</dtval>' . '</dates>' . '<rule freq="' . Frequency::SECOND() . '">' . '<until d="' . $date . '" />' . '<count num="' . $num . '" />' . '<interval ival="' . $num . '" />' . '<bysecond seclist="' . $seclist . '" />' . '<byminute minlist="' . $minlist . '" />' . '<byhour hrlist="' . $hrlist . '" />' . '<byday>' . '<wkday day="' . WeekDay::SU() . '" ordwk="' . $ordwk . '" />' . '</byday>' . '<bymonthday modaylist="' . $modaylist . '" />' . '<byyearday yrdaylist="' . $yrdaylist . '" />' . '<byweekno wklist="' . $wklist . '" />' . '<bymonth molist="' . $molist . '" />' . '<bysetpos poslist="' . $poslist . '" />' . '<wkst day="' . WeekDay::SU() . '" />' . '<rule-x-name name="' . $name . '" value="' . $value . '" />' . '</rule>' . '</recur>' . '<exceptId d="' . $date . '" tz="' . $tz . '" rangeType="' . RangeType::NONE() . '" />' . '<s d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<e d="' . $date . '" tz="' . $tz . '" u="' . $utc . '" />' . '<dur neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '<category>' . $category . '</category>' . '<comment>' . $comment . '</comment>' . '<contact>' . $contact . '</contact>' . '<at a="' . $address . '" url="' . $url . '" d="' . $displayName . '" sentBy="' . $sentBy . '" dir="' . $dir . '" lang="' . $lang . '" cutype="' . $cutype . '" role="' . $role . '" ptst="' . ParticipationStatus::NEEDS_ACTION() . '" rsvp="true" member="' . $member . '" delTo="' . $delTo . '" delFrom="' . $delFrom . '">' . '<xparam name="' . $name . '" value="' . $value . '" />' . '</at>' . '<alarm action="' . AlarmAction::DISPLAY() . '">' . '<trigger>' . '<abs d="' . $date . '" />' . '<rel neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '</trigger>' . '<repeat neg="false" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $num . '" />' . '<desc>' . $desc . '</desc>' . '<attach uri="' . $uri . '" ct="' . $ct . '">' . $value . '</attach>' . '<summary>' . $summary . '</summary>' . '<at a="' . $address . '" url="' . $url . '" d="' . $displayName . '" sentBy="' . $sentBy . '" dir="' . $dir . '" lang="' . $lang . '" cutype="' . $cutype . '" role="' . $role . '" ptst="' . ParticipationStatus::NEEDS_ACTION() . '" rsvp="true" member="' . $member . '" delTo="' . $delTo . '" delFrom="' . $delFrom . '">' . '<xparam name="' . $name . '" value="' . $value . '" />' . '</at>' . '<xprop name="' . $name . '" value="' . $value . '">' . '<xparam name="' . $name . '" value="' . $value . '" />' . '</xprop>' . '</alarm>' . '<xprop name="' . $name . '" value="' . $value . '">' . '<xparam name="' . $name . '" value="' . $value . '" />' . '</xprop>' . '</comp>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $comp);
     $array = array('comp' => array('method' => $method, 'compNum' => $compNum, 'rsvp' => true, 'priority' => $priority, 'name' => $name, 'loc' => $loc, 'percentComplete' => $percent, 'completed' => $date, 'noBlob' => true, 'fba' => FreeBusyStatus::FREE()->value(), 'fb' => FreeBusyStatus::FREE()->value(), 'transp' => Transparency::OPAQUE()->value(), 'isOrg' => true, 'x_uid' => $x_uid, 'uid' => $uid, 'seq' => $seq, 'd' => $d, 'calItemId' => $calItemId, 'apptId' => $apptId, 'ciFolder' => $ciFolder, 'status' => InviteStatus::COMPLETED()->value(), 'class' => InviteClass::PUB()->value(), 'url' => $url, 'ex' => true, 'ridZ' => $ridZ, 'allDay' => true, 'draft' => true, 'neverSent' => true, 'changes' => InviteChange::SUBJECT()->value() . ',' . InviteChange::LOCATION()->value() . ',' . InviteChange::TIME()->value(), 'category' => array($category), 'comment' => array($comment), 'contact' => array($contact), 'geo' => array('lat' => $lat, 'lon' => $lon), 'at' => array(array('a' => $address, 'url' => $url, 'd' => $displayName, 'sentBy' => $sentBy, 'dir' => $dir, 'lang' => $lang, 'cutype' => $cutype, 'role' => $role, 'ptst' => ParticipationStatus::NEEDS_ACTION()->value(), 'rsvp' => true, 'member' => $member, 'delTo' => $delTo, 'delFrom' => $delFrom, 'xparam' => array(array('name' => $name, 'value' => $value)))), 'alarm' => array(array('action' => AlarmAction::DISPLAY()->value(), 'trigger' => array('abs' => array('d' => $date), 'rel' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num)), 'repeat' => array('neg' => false, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num), 'desc' => $desc, 'attach' => array('uri' => $uri, 'ct' => $ct, '_content' => $value), 'summary' => $summary, 'at' => array(array('a' => $address, 'url' => $url, 'd' => $displayName, 'sentBy' => $sentBy, 'dir' => $dir, 'lang' => $lang, 'cutype' => $cutype, 'role' => $role, 'ptst' => ParticipationStatus::NEEDS_ACTION()->value(), 'rsvp' => true, 'member' => $member, 'delTo' => $delTo, 'delFrom' => $delFrom, 'xparam' => array(array('name' => $name, 'value' => $value)))), 'xprop' => array(array('name' => $name, 'value' => $value, 'xparam' => array(array('name' => $name, 'value' => $value)))))), 'xprop' => array(array('name' => $name, 'value' => $value, 'xparam' => array(array('name' => $name, 'value' => $value)))), 'fr' => $fr, 'desc' => $desc, 'descHtml' => $descHtml, 'or' => array('a' => $address, 'url' => $url, 'd' => $displayName, 'sentBy' => $sentBy, 'dir' => $dir, 'lang' => $lang, 'xparam' => array(array('name' => $name, 'value' => $value))), 'recur' => array('add' => array('except' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'cancel' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'dates' => array('tz' => $tz, 'dtval' => array(array('s' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'e' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'dur' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num)))), 'rule' => array('freq' => Frequency::SECOND()->value(), 'until' => array('d' => $date), 'count' => array('num' => $num), 'interval' => array('ival' => $num), 'bysecond' => array('seclist' => $seclist), 'byminute' => array('minlist' => $minlist), 'byhour' => array('hrlist' => $hrlist), 'byday' => array('wkday' => array(array('day' => WeekDay::SU()->value(), 'ordwk' => $ordwk))), 'bymonthday' => array('modaylist' => $modaylist), 'byyearday' => array('yrdaylist' => $yrdaylist), 'byweekno' => array('wklist' => $wklist), 'bymonth' => array('molist' => $molist), 'bysetpos' => array('poslist' => $poslist), 'wkst' => array('day' => WeekDay::SU()->value()), 'rule-x-name' => array(array('name' => $name, 'value' => $value)))), 'exclude' => array('except' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'cancel' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'dates' => array('tz' => $tz, 'dtval' => array(array('s' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'e' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'dur' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num)))), 'rule' => array('freq' => Frequency::SECOND()->value(), 'until' => array('d' => $date), 'count' => array('num' => $num), 'interval' => array('ival' => $num), 'bysecond' => array('seclist' => $seclist), 'byminute' => array('minlist' => $minlist), 'byhour' => array('hrlist' => $hrlist), 'byday' => array('wkday' => array(array('day' => WeekDay::SU()->value(), 'ordwk' => $ordwk))), 'bymonthday' => array('modaylist' => $modaylist), 'byyearday' => array('yrdaylist' => $yrdaylist), 'byweekno' => array('wklist' => $wklist), 'bymonth' => array('molist' => $molist), 'bysetpos' => array('poslist' => $poslist), 'wkst' => array('day' => WeekDay::SU()->value()), 'rule-x-name' => array(array('name' => $name, 'value' => $value)))), 'except' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'cancel' => array('rangeType' => $rangeType, 'recurId' => $date, 'tz' => $tz, 'ridZ' => $ridZ), 'dates' => array('tz' => $tz, 'dtval' => array(array('s' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'e' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'dur' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num)))), 'rule' => array('freq' => Frequency::SECOND()->value(), 'until' => array('d' => $date), 'count' => array('num' => $num), 'interval' => array('ival' => $num), 'bysecond' => array('seclist' => $seclist), 'byminute' => array('minlist' => $minlist), 'byhour' => array('hrlist' => $hrlist), 'byday' => array('wkday' => array(array('day' => WeekDay::SU()->value(), 'ordwk' => $ordwk))), 'bymonthday' => array('modaylist' => $modaylist), 'byyearday' => array('yrdaylist' => $yrdaylist), 'byweekno' => array('wklist' => $wklist), 'bymonth' => array('molist' => $molist), 'bysetpos' => array('poslist' => $poslist), 'wkst' => array('day' => WeekDay::SU()->value()), 'rule-x-name' => array(array('name' => $name, 'value' => $value)))), 'exceptId' => array('d' => $date, 'tz' => $tz, 'rangeType' => RangeType::NONE()->value()), 's' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'e' => array('d' => $date, 'tz' => $tz, 'u' => $utc), 'dur' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $num)));
     $this->assertEquals($array, $comp->toArray());
 }
コード例 #3
0
ファイル: AlarmInfoTest.php プロジェクト: zimbra-api/mail
 public function testAlarmInfo()
 {
     $date = $this->faker->iso8601;
     $name = $this->faker->word;
     $value = $this->faker->word;
     $weeks = mt_rand(1, 7);
     $days = mt_rand(1, 30);
     $hours = mt_rand(0, 23);
     $minutes = mt_rand(0, 59);
     $seconds = mt_rand(0, 59);
     $related = $this->faker->randomElement(['START', 'END']);
     $count = mt_rand(0, 99);
     $uri = $this->faker->word;
     $ct = $this->faker->word;
     $address = $this->faker->word;
     $url = $this->faker->word;
     $displayName = $this->faker->word;
     $sentBy = $this->faker->word;
     $dir = $this->faker->word;
     $lang = $this->faker->word;
     $cutype = $this->faker->word;
     $role = $this->faker->word;
     $member = $this->faker->word;
     $delTo = $this->faker->word;
     $delFrom = $this->faker->word;
     $description = $this->faker->word;
     $summary = $this->faker->word;
     $abs = new DateAttr($date);
     $rel = new DurationInfo(true, $weeks, $days, $hours, $minutes, $seconds, $related, $count);
     $trigger = new AlarmTriggerInfo($abs, $rel);
     $repeat = new DurationInfo(false, $weeks, $days, $hours, $minutes, $seconds, $related, $count);
     $attach = new CalendarAttach($uri, $ct, $value);
     $name1 = $this->faker->word;
     $value1 = $this->faker->word;
     $xparam1 = new XParam($name1, $value1);
     $at = new CalendarAttendee($address, $url, $displayName, $sentBy, $dir, $lang, $cutype, $role, ParticipationStatus::NEEDS_ACTION(), true, $member, $delTo, $delFrom, [$xparam1]);
     $name2 = $this->faker->word;
     $value2 = $this->faker->word;
     $xparam2 = new XParam($name2, $value2);
     $xprop = new XProp($name, $value, [$xparam2]);
     $alarm = new AlarmInfo(AlarmAction::DISPLAY(), $trigger, $repeat, $description, $attach, $summary, [$at], [$xprop]);
     $this->assertSame('DISPLAY', (string) $alarm->getAction());
     $this->assertSame($trigger, $alarm->getTrigger());
     $this->assertSame($repeat, $alarm->getRepeat());
     $this->assertSame($description, $alarm->getDescription());
     $this->assertSame($attach, $alarm->getAttach());
     $this->assertSame($summary, $alarm->getSummary());
     $this->assertSame(array($at), $alarm->getAttendees()->all());
     $this->assertSame(array($xprop), $alarm->getXProps()->all());
     $alarm->addAttendee($at);
     $alarm->addXProp($xprop);
     $this->assertSame([$at, $at], $alarm->getAttendees()->all());
     $this->assertSame([$xprop, $xprop], $alarm->getXProps()->all());
     $alarm->setAction(AlarmAction::DISPLAY())->setTrigger($trigger)->setRepeat($repeat)->setDescription($description)->setAttach($attach)->setSummary($summary);
     $this->assertSame('DISPLAY', (string) $alarm->getAction());
     $this->assertSame($trigger, $alarm->getTrigger());
     $this->assertSame($repeat, $alarm->getRepeat());
     $this->assertSame($description, $alarm->getDescription());
     $this->assertSame($attach, $alarm->getAttach());
     $this->assertSame($summary, $alarm->getSummary());
     $alarm->getAttendees()->remove(1);
     $alarm->getXProps()->remove(1);
     $rel = new DurationInfo(true, $weeks, $days, $hours, $minutes, $seconds, $related, $count);
     $xml = '<?xml version="1.0"?>' . "\n" . '<alarm action="' . AlarmAction::DISPLAY() . '">' . '<trigger>' . '<abs d="' . $date . '" />' . '<rel neg="true" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $count . '" />' . '</trigger>' . '<repeat neg="false" w="' . $weeks . '" d="' . $days . '" h="' . $hours . '" m="' . $minutes . '" s="' . $seconds . '" related="' . $related . '" count="' . $count . '" />' . '<desc>' . $description . '</desc>' . '<attach uri="' . $uri . '" ct="' . $ct . '">' . $value . '</attach>' . '<summary>' . $summary . '</summary>' . '<at a="' . $address . '" url="' . $url . '" d="' . $displayName . '" sentBy="' . $sentBy . '" dir="' . $dir . '" lang="' . $lang . '" cutype="' . $cutype . '" role="' . $role . '" ptst="' . ParticipationStatus::NEEDS_ACTION() . '" rsvp="true" member="' . $member . '" delTo="' . $delTo . '" delFrom="' . $delFrom . '">' . '<xparam name="' . $name1 . '" value="' . $value1 . '" />' . '</at>' . '<xprop name="' . $name . '" value="' . $value . '">' . '<xparam name="' . $name2 . '" value="' . $value2 . '" />' . '</xprop>' . '</alarm>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $alarm);
     $array = array('alarm' => array('action' => AlarmAction::DISPLAY()->value(), 'trigger' => array('abs' => array('d' => $date), 'rel' => array('neg' => true, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $count)), 'repeat' => array('neg' => false, 'w' => $weeks, 'd' => $days, 'h' => $hours, 'm' => $minutes, 's' => $seconds, 'related' => $related, 'count' => $count), 'desc' => $description, 'attach' => array('uri' => $uri, 'ct' => $ct, '_content' => $value), 'summary' => $summary, 'at' => array(array('a' => $address, 'url' => $url, 'd' => $displayName, 'sentBy' => $sentBy, 'dir' => $dir, 'lang' => $lang, 'cutype' => $cutype, 'role' => $role, 'ptst' => ParticipationStatus::NEEDS_ACTION()->value(), 'rsvp' => true, 'member' => $member, 'delTo' => $delTo, 'delFrom' => $delFrom, 'xparam' => array(array('name' => $name1, 'value' => $value1)))), 'xprop' => array(array('name' => $name, 'value' => $value, 'xparam' => array(array('name' => $name2, 'value' => $value2))))));
     $this->assertEquals($array, $alarm->toArray());
 }
コード例 #4
0
ファイル: StructTest.php プロジェクト: nucleus-be/zimbra-api
 public function testInviteComponent()
 {
     $xparam = new \Zimbra\Mail\Struct\XParam('name', 'value');
     $at = new \Zimbra\Mail\Struct\CalendarAttendee(array($xparam), 'a', 'url', 'd', 'sentBy', 'dir', 'lang', 'cutype', 'role', ParticipationStatus::NE(), true, 'member', 'delTo', 'delFrom');
     $abs = new \Zimbra\Mail\Struct\DateAttr('20120315T18302305Z');
     $rel = new \Zimbra\Mail\Struct\DurationInfo(true, 7, 2, 3, 4, 5, 'START', 6);
     $trigger = new \Zimbra\Mail\Struct\AlarmTriggerInfo($abs, $rel);
     $repeat = new \Zimbra\Mail\Struct\DurationInfo(false, 7, 2, 3, 4, 5, 'START', 6);
     $attach = new \Zimbra\Mail\Struct\CalendarAttach('uri', 'ct', 'value');
     $except = new \Zimbra\Mail\Struct\ExceptionRuleInfo(10, '991231', null, null, 'tz', '991231000000');
     $cancel = new \Zimbra\Mail\Struct\CancelRuleInfo(10, '991231', 'tz', '991231000000');
     $s = new \Zimbra\Mail\Struct\DtTimeInfo('20120315T18302305Z', 'tz', 1000);
     $e = new \Zimbra\Mail\Struct\DtTimeInfo('20130315T18302305Z', 'tz', 2000);
     $dur = new \Zimbra\Mail\Struct\DurationInfo(true, 7, 2, 3, 4, 5, 'START', 6);
     $dtval = new \Zimbra\Mail\Struct\DtVal($s, $e, $dur);
     $dates = new \Zimbra\Mail\Struct\SingleDates(array($dtval), 'tz');
     $wkday = new \Zimbra\Mail\Struct\WkDay(WeekDay::SU(), 10);
     $until = new \Zimbra\Mail\Struct\DateTimeStringAttr('20120315T18302305Z');
     $count = new \Zimbra\Mail\Struct\NumAttr(20120315);
     $interval = new \Zimbra\Mail\Struct\IntervalRule(20120315);
     $bysecond = new \Zimbra\Mail\Struct\BySecondRule('10,a,20,b,30');
     $byminute = new \Zimbra\Mail\Struct\ByMinuteRule('10,a,20,b,30');
     $byhour = new \Zimbra\Mail\Struct\ByHourRule('5,a,10,b,15');
     $byday = new \Zimbra\Mail\Struct\ByDayRule(array($wkday));
     $bymonthday = new \Zimbra\Mail\Struct\ByMonthDayRule('5,a,10,b,15,32');
     $byyearday = new \Zimbra\Mail\Struct\ByYearDayRule('5,a,10,b,15,367');
     $byweekno = new \Zimbra\Mail\Struct\ByWeekNoRule('5,a,10,b,15,54');
     $bymonth = new \Zimbra\Mail\Struct\ByMonthRule('5,a,10,b,15');
     $bysetpos = new \Zimbra\Mail\Struct\BySetPosRule('5,a,10,b,15,367');
     $wkst = new \Zimbra\Mail\Struct\WkstRule(WeekDay::SU());
     $xname = new \Zimbra\Mail\Struct\XNameRule('name', 'value');
     $rule = new \Zimbra\Mail\Struct\SimpleRepeatingRule(Frequency::SEC(), $until, $count, $interval, $bysecond, $byminute, $byhour, $byday, $bymonthday, $byyearday, $byweekno, $bymonth, $bysetpos, $wkst, array($xname));
     $add = new \Zimbra\Mail\Struct\AddRecurrenceInfo(null, null, $except, $cancel, $dates, $rule);
     $exclude = new \Zimbra\Mail\Struct\ExcludeRecurrenceInfo(null, null, $except, $cancel, $dates, $rule);
     $geo = new \Zimbra\Mail\Struct\GeoInfo(123.456, 654.321);
     $xprop = new \Zimbra\Mail\Struct\XProp('name', 'value', array($xparam));
     $alarm = new \Zimbra\Mail\Struct\AlarmInfo(AlarmAction::DISPLAY(), $trigger, $repeat, 'desc', $attach, 'summary', array($at), array($xprop));
     $org = new \Zimbra\Mail\Struct\CalOrganizer(array($xparam), 'a', 'url', 'd', 'sentBy', 'dir', 'lang');
     $recur = new \Zimbra\Mail\Struct\RecurrenceInfo($add, $exclude, $except, $cancel, $dates, $rule);
     $exceptId = new \Zimbra\Mail\Struct\ExceptionRecurIdInfo('20120315T18302305Z', 'tz', -1);
     $comp = new \Zimbra\Mail\Struct\InviteComponent('method', 10, true, 10, 'name', 'loc', 10, '20120315T18302305Z', true, FreeBusyStatus::F(), FreeBusyStatus::F(), Transparency::O(), true, 'x_uid', 'uid', 10, 10, 'calItemId', 'apptId', 'ciFolder', InviteStatus::COMP(), InviteClass::PUB(), 'url', true, 'ridZ', true, true, true, array(InviteChange::SUBJECT(), InviteChange::LOCATION(), InviteChange::TIME()), array('category1'), array('comment1'), array('contact1'), $geo, array($at), array($alarm), array($xprop), 'fr', 'desc', 'descHtml', $org, $recur, $exceptId, $s, $e, $dur);
     $this->assertSame(array('category1'), $comp->category()->all());
     $this->assertSame(array('comment1'), $comp->comment()->all());
     $this->assertSame(array('contact1'), $comp->contact()->all());
     $this->assertSame($geo, $comp->geo());
     $this->assertSame(array($at), $comp->at()->all());
     $this->assertSame(array($alarm), $comp->alarm()->all());
     $this->assertSame(array($xprop), $comp->xprop()->all());
     $this->assertSame('fr', $comp->fr());
     $this->assertSame('desc', $comp->desc());
     $this->assertSame('descHtml', $comp->descHtml());
     $this->assertSame($org, $comp->org());
     $this->assertSame($recur, $comp->recur());
     $this->assertSame($exceptId, $comp->exceptId());
     $this->assertSame($s, $comp->s());
     $this->assertSame($e, $comp->e());
     $this->assertSame($dur, $comp->dur());
     $comp->addCategory('category2')->addComment('comment2')->addContact('contact2')->geo($geo)->addAt($at)->addAlarm($alarm)->addXProp($xprop)->fr('fr')->desc('desc')->descHtml('descHtml')->org($org)->recur($recur)->exceptId($exceptId)->s($s)->e($e)->dur($dur);
     $this->assertSame(array('category1', 'category2'), $comp->category()->all());
     $this->assertSame(array('comment1', 'comment2'), $comp->comment()->all());
     $this->assertSame(array('contact1', 'contact2'), $comp->contact()->all());
     $this->assertSame($geo, $comp->geo());
     $this->assertSame(array($at, $at), $comp->at()->all());
     $this->assertSame(array($alarm, $alarm), $comp->alarm()->all());
     $this->assertSame(array($xprop, $xprop), $comp->xprop()->all());
     $this->assertSame('fr', $comp->fr());
     $this->assertSame('desc', $comp->desc());
     $this->assertSame('descHtml', $comp->descHtml());
     $this->assertSame($org, $comp->org());
     $this->assertSame($recur, $comp->recur());
     $this->assertSame($exceptId, $comp->exceptId());
     $this->assertSame($s, $comp->s());
     $this->assertSame($e, $comp->e());
     $this->assertSame($dur, $comp->dur());
     $comp = new \Zimbra\Mail\Struct\InviteComponent('method', 10, true, 10, 'name', 'loc', 10, '20120315T18302305Z', true, FreeBusyStatus::F(), FreeBusyStatus::F(), Transparency::O(), true, 'x_uid', 'uid', 10, 10, 'calItemId', 'apptId', 'ciFolder', InviteStatus::COMP(), InviteClass::PUB(), 'url', true, 'ridZ', true, true, true, array(InviteChange::SUBJECT(), InviteChange::LOCATION(), InviteChange::TIME()), array('category1', 'category2'), array('comment1', 'comment2'), array('contact1', 'contact2'), $geo, array($at), array($alarm), array($xprop), 'fr', 'desc', 'descHtml', $org, $recur, $exceptId, $s, $e, $dur);
     $xml = '<?xml version="1.0"?>' . "\n" . '<comp' . ' method="method"' . ' compNum="10"' . ' rsvp="true"' . ' priority="10"' . ' name="name"' . ' loc="loc"' . ' percentComplete="10"' . ' completed="20120315T18302305Z"' . ' noBlob="true"' . ' fba="F"' . ' fb="F"' . ' transp="O"' . ' isOrg="true"' . ' x_uid="x_uid"' . ' uid="uid"' . ' seq="10"' . ' d="10"' . ' calItemId="calItemId"' . ' apptId="apptId"' . ' ciFolder="ciFolder"' . ' status="COMP"' . ' class="PUB"' . ' url="url"' . ' ex="true"' . ' ridZ="ridZ"' . ' allDay="true"' . ' draft="true"' . ' neverSent="true"' . ' changes="subject,location,time">' . '<geo lat="123.456" lon="654.321" />' . '<fr>fr</fr>' . '<desc>desc</desc>' . '<descHtml>descHtml</descHtml>' . '<or a="a" url="url" d="d" sentBy="sentBy" dir="dir" lang="lang">' . '<xparam name="name" value="value" />' . '</or>' . '<recur>' . '<add>' . '<except rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<cancel rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<dates tz="tz">' . '<dtval>' . '<s d="20120315T18302305Z" tz="tz" u="1000" />' . '<e d="20130315T18302305Z" tz="tz" u="2000" />' . '<dur neg="true" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '</dtval>' . '</dates>' . '<rule freq="SEC">' . '<until d="20120315T18302305Z" />' . '<count num="20120315" />' . '<interval ival="20120315" />' . '<bysecond seclist="10,20,30" />' . '<byminute minlist="10,20,30" />' . '<byhour hrlist="5,10,15" />' . '<byday>' . '<wkday day="SU" ordwk="10" />' . '</byday>' . '<bymonthday modaylist="5,10,15" />' . '<byyearday yrdaylist="5,10,15" />' . '<byweekno wklist="5,10,15" />' . '<bymonth molist="5,10" />' . '<bysetpos poslist="5,10,15" />' . '<wkst day="SU" />' . '<rule-x-name name="name" value="value" />' . '</rule>' . '</add>' . '<exclude>' . '<except rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<cancel rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<dates tz="tz">' . '<dtval>' . '<s d="20120315T18302305Z" tz="tz" u="1000" />' . '<e d="20130315T18302305Z" tz="tz" u="2000" />' . '<dur neg="true" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '</dtval>' . '</dates>' . '<rule freq="SEC">' . '<until d="20120315T18302305Z" />' . '<count num="20120315" />' . '<interval ival="20120315" />' . '<bysecond seclist="10,20,30" />' . '<byminute minlist="10,20,30" />' . '<byhour hrlist="5,10,15" />' . '<byday>' . '<wkday day="SU" ordwk="10" />' . '</byday>' . '<bymonthday modaylist="5,10,15" />' . '<byyearday yrdaylist="5,10,15" />' . '<byweekno wklist="5,10,15" />' . '<bymonth molist="5,10" />' . '<bysetpos poslist="5,10,15" />' . '<wkst day="SU" />' . '<rule-x-name name="name" value="value" />' . '</rule>' . '</exclude>' . '<except rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<cancel rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '<dates tz="tz">' . '<dtval>' . '<s d="20120315T18302305Z" tz="tz" u="1000" />' . '<e d="20130315T18302305Z" tz="tz" u="2000" />' . '<dur neg="true" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '</dtval>' . '</dates>' . '<rule freq="SEC">' . '<until d="20120315T18302305Z" />' . '<count num="20120315" />' . '<interval ival="20120315" />' . '<bysecond seclist="10,20,30" />' . '<byminute minlist="10,20,30" />' . '<byhour hrlist="5,10,15" />' . '<byday>' . '<wkday day="SU" ordwk="10" />' . '</byday>' . '<bymonthday modaylist="5,10,15" />' . '<byyearday yrdaylist="5,10,15" />' . '<byweekno wklist="5,10,15" />' . '<bymonth molist="5,10" />' . '<bysetpos poslist="5,10,15" />' . '<wkst day="SU" />' . '<rule-x-name name="name" value="value" />' . '</rule>' . '</recur>' . '<exceptId d="20120315T18302305Z" tz="tz" rangeType="-1" />' . '<s d="20120315T18302305Z" tz="tz" u="1000" />' . '<e d="20130315T18302305Z" tz="tz" u="2000" />' . '<dur neg="true" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '<category>category1</category>' . '<category>category2</category>' . '<comment>comment1</comment>' . '<comment>comment2</comment>' . '<contact>contact1</contact>' . '<contact>contact2</contact>' . '<at a="a" url="url" d="d" sentBy="sentBy" dir="dir" lang="lang" cutype="cutype" role="role" ptst="NE" rsvp="true" member="member" delTo="delTo" delFrom="delFrom">' . '<xparam name="name" value="value" />' . '</at>' . '<alarm action="DISPLAY">' . '<trigger>' . '<abs d="20120315T18302305Z" />' . '<rel neg="true" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '</trigger>' . '<repeat neg="false" w="7" d="2" h="3" m="4" s="5" related="START" count="6" />' . '<desc>desc</desc>' . '<attach uri="uri" ct="ct">value</attach>' . '<summary>summary</summary>' . '<at a="a" url="url" d="d" sentBy="sentBy" dir="dir" lang="lang" cutype="cutype" role="role" ptst="NE" rsvp="true" member="member" delTo="delTo" delFrom="delFrom">' . '<xparam name="name" value="value" />' . '</at>' . '<xprop name="name" value="value">' . '<xparam name="name" value="value" />' . '</xprop>' . '</alarm>' . '<xprop name="name" value="value">' . '<xparam name="name" value="value" />' . '</xprop>' . '</comp>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $comp);
     $array = array('comp' => array('method' => 'method', 'compNum' => 10, 'rsvp' => true, 'priority' => 10, 'name' => 'name', 'loc' => 'loc', 'percentComplete' => 10, 'completed' => '20120315T18302305Z', 'noBlob' => true, 'fba' => 'F', 'fb' => 'F', 'transp' => 'O', 'isOrg' => true, 'x_uid' => 'x_uid', 'uid' => 'uid', 'seq' => 10, 'd' => 10, 'calItemId' => 'calItemId', 'apptId' => 'apptId', 'ciFolder' => 'ciFolder', 'status' => 'COMP', 'class' => 'PUB', 'url' => 'url', 'ex' => true, 'ridZ' => 'ridZ', 'allDay' => true, 'draft' => true, 'neverSent' => true, 'changes' => 'subject,location,time', 'category' => array('category1', 'category2'), 'comment' => array('comment1', 'comment2'), 'contact' => array('contact1', 'contact2'), 'geo' => array('lat' => 123.456, 'lon' => 654.321), 'at' => array(array('a' => 'a', 'url' => 'url', 'd' => 'd', 'sentBy' => 'sentBy', 'dir' => 'dir', 'lang' => 'lang', 'cutype' => 'cutype', 'role' => 'role', 'ptst' => 'NE', 'rsvp' => true, 'member' => 'member', 'delTo' => 'delTo', 'delFrom' => 'delFrom', 'xparam' => array(array('name' => 'name', 'value' => 'value')))), 'alarm' => array(array('action' => 'DISPLAY', 'trigger' => array('abs' => array('d' => '20120315T18302305Z'), 'rel' => array('neg' => true, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6)), 'repeat' => array('neg' => false, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6), 'desc' => 'desc', 'attach' => array('uri' => 'uri', 'ct' => 'ct', '_content' => 'value'), 'summary' => 'summary', 'at' => array(array('a' => 'a', 'url' => 'url', 'd' => 'd', 'sentBy' => 'sentBy', 'dir' => 'dir', 'lang' => 'lang', 'cutype' => 'cutype', 'role' => 'role', 'ptst' => 'NE', 'rsvp' => true, 'member' => 'member', 'delTo' => 'delTo', 'delFrom' => 'delFrom', 'xparam' => array(array('name' => 'name', 'value' => 'value')))), 'xprop' => array(array('name' => 'name', 'value' => 'value', 'xparam' => array(array('name' => 'name', 'value' => 'value')))))), 'xprop' => array(array('name' => 'name', 'value' => 'value', 'xparam' => array(array('name' => 'name', 'value' => 'value')))), 'fr' => 'fr', 'desc' => 'desc', 'descHtml' => 'descHtml', 'or' => array('a' => 'a', 'url' => 'url', 'd' => 'd', 'sentBy' => 'sentBy', 'dir' => 'dir', 'lang' => 'lang', 'xparam' => array(array('name' => 'name', 'value' => 'value'))), 'recur' => array('add' => array('except' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'cancel' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'dates' => array('tz' => 'tz', 'dtval' => array(array('s' => array('d' => '20120315T18302305Z', 'tz' => 'tz', 'u' => 1000), 'e' => array('d' => '20130315T18302305Z', 'tz' => 'tz', 'u' => 2000), 'dur' => array('neg' => true, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6)))), 'rule' => array('freq' => 'SEC', 'until' => array('d' => '20120315T18302305Z'), 'count' => array('num' => 20120315), 'interval' => array('ival' => 20120315), 'bysecond' => array('seclist' => '10,20,30'), 'byminute' => array('minlist' => '10,20,30'), 'byhour' => array('hrlist' => '5,10,15'), 'byday' => array('wkday' => array(array('day' => 'SU', 'ordwk' => 10))), 'bymonthday' => array('modaylist' => '5,10,15'), 'byyearday' => array('yrdaylist' => '5,10,15'), 'byweekno' => array('wklist' => '5,10,15'), 'bymonth' => array('molist' => '5,10'), 'bysetpos' => array('poslist' => '5,10,15'), 'wkst' => array('day' => 'SU'), 'rule-x-name' => array(array('name' => 'name', 'value' => 'value')))), 'exclude' => array('except' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'cancel' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'dates' => array('tz' => 'tz', 'dtval' => array(array('s' => array('d' => '20120315T18302305Z', 'tz' => 'tz', 'u' => 1000), 'e' => array('d' => '20130315T18302305Z', 'tz' => 'tz', 'u' => 2000), 'dur' => array('neg' => true, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6)))), 'rule' => array('freq' => 'SEC', 'until' => array('d' => '20120315T18302305Z'), 'count' => array('num' => 20120315), 'interval' => array('ival' => 20120315), 'bysecond' => array('seclist' => '10,20,30'), 'byminute' => array('minlist' => '10,20,30'), 'byhour' => array('hrlist' => '5,10,15'), 'byday' => array('wkday' => array(array('day' => 'SU', 'ordwk' => 10))), 'bymonthday' => array('modaylist' => '5,10,15'), 'byyearday' => array('yrdaylist' => '5,10,15'), 'byweekno' => array('wklist' => '5,10,15'), 'bymonth' => array('molist' => '5,10'), 'bysetpos' => array('poslist' => '5,10,15'), 'wkst' => array('day' => 'SU'), 'rule-x-name' => array(array('name' => 'name', 'value' => 'value')))), 'except' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'cancel' => array('rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000'), 'dates' => array('tz' => 'tz', 'dtval' => array(array('s' => array('d' => '20120315T18302305Z', 'tz' => 'tz', 'u' => 1000), 'e' => array('d' => '20130315T18302305Z', 'tz' => 'tz', 'u' => 2000), 'dur' => array('neg' => true, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6)))), 'rule' => array('freq' => 'SEC', 'until' => array('d' => '20120315T18302305Z'), 'count' => array('num' => 20120315), 'interval' => array('ival' => 20120315), 'bysecond' => array('seclist' => '10,20,30'), 'byminute' => array('minlist' => '10,20,30'), 'byhour' => array('hrlist' => '5,10,15'), 'byday' => array('wkday' => array(array('day' => 'SU', 'ordwk' => 10))), 'bymonthday' => array('modaylist' => '5,10,15'), 'byyearday' => array('yrdaylist' => '5,10,15'), 'byweekno' => array('wklist' => '5,10,15'), 'bymonth' => array('molist' => '5,10'), 'bysetpos' => array('poslist' => '5,10,15'), 'wkst' => array('day' => 'SU'), 'rule-x-name' => array(array('name' => 'name', 'value' => 'value')))), 'exceptId' => array('d' => '20120315T18302305Z', 'tz' => 'tz', 'rangeType' => -1), 's' => array('d' => '20120315T18302305Z', 'tz' => 'tz', 'u' => 1000), 'e' => array('d' => '20130315T18302305Z', 'tz' => 'tz', 'u' => 2000), 'dur' => array('neg' => true, 'w' => 7, 'd' => 2, 'h' => 3, 'm' => 4, 's' => 5, 'related' => 'START', 'count' => 6)));
     $this->assertEquals($array, $comp->toArray());
 }