Ejemplo n.º 1
0
 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());
 }