Example #1
0
 public function testCalReply()
 {
     $attendee = $this->faker->word;
     $sequence = mt_rand(1, 100);
     $date = mt_rand(1, 100);
     $rangeType = mt_rand(1, 100);
     $recurId = $this->faker->iso8601;
     $sentBy = $this->faker->word;
     $tz = $this->faker->word;
     $ridZ = $this->faker->iso8601;
     $reply = new CalReply($attendee, $sequence, $date, $rangeType, $recurId, $sentBy, ParticipationStatus::NEEDS_ACTION(), $tz, $ridZ);
     $this->assertSame($attendee, $reply->getAttendee());
     $this->assertSame($sequence, $reply->getSequence());
     $this->assertSame($date, $reply->getDate());
     $this->assertSame($sentBy, $reply->getSentBy());
     $this->assertTrue($reply->getPartStat()->is('NE'));
     $reply->setAttendee($attendee)->setSequence($sequence)->setDate($date)->setSentBy($sentBy)->setPartStat(ParticipationStatus::NEEDS_ACTION());
     $this->assertSame($attendee, $reply->getAttendee());
     $this->assertSame($sequence, $reply->getSequence());
     $this->assertSame($date, $reply->getDate());
     $this->assertSame($sentBy, $reply->getSentBy());
     $this->assertTrue($reply->getPartStat()->is('NE'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<reply at="' . $attendee . '" seq="' . $sequence . '" d="' . $date . '" sentBy="' . $sentBy . '" ptst="' . ParticipationStatus::NEEDS_ACTION() . '" rangeType="' . $rangeType . '" recurId="' . $recurId . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $reply);
     $array = array('reply' => array('at' => $attendee, 'seq' => $sequence, 'd' => $date, 'sentBy' => $sentBy, 'ptst' => ParticipationStatus::NEEDS_ACTION()->value(), 'rangeType' => $rangeType, 'recurId' => $recurId, 'tz' => $tz, 'ridZ' => $ridZ));
     $this->assertEquals($array, $reply->toArray());
 }
Example #2
0
 public function testCalendarAttendee()
 {
     $name1 = $this->faker->word;
     $value1 = $this->faker->word;
     $name2 = $this->faker->word;
     $value2 = $this->faker->word;
     $xparam1 = new XParam($name1, $value1);
     $xparam2 = new XParam($name2, $value2);
     $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;
     $cal = new CalendarAttendee($address, $url, $displayName, $sentBy, $dir, $lang, $cutype, $role, ParticipationStatus::NEEDS_ACTION(), true, $member, $delTo, $delFrom, [$xparam1]);
     $this->assertSame([$xparam1], $cal->getXParams()->all());
     $this->assertSame($address, $cal->getAddress());
     $this->assertSame($url, $cal->getUrl());
     $this->assertSame($displayName, $cal->getDisplayName());
     $this->assertSame($sentBy, $cal->getSentBy());
     $this->assertSame($dir, $cal->getDir());
     $this->assertSame($lang, $cal->getLanguage());
     $this->assertSame($cutype, $cal->getCuType());
     $this->assertSame($role, $cal->getRole());
     $this->assertTrue($cal->getPartStat()->is('NE'));
     $this->assertTrue($cal->getRsvp());
     $this->assertSame($member, $cal->getMember());
     $this->assertSame($delTo, $cal->getDelegatedTo());
     $this->assertSame($delFrom, $cal->getDelegatedFrom());
     $cal->addXParam($xparam2);
     $this->assertSame([$xparam1, $xparam2], $cal->getXParams()->all());
     $cal->setAddress($address)->setUrl($url)->setDisplayName($displayName)->setSentBy($sentBy)->setDir($dir)->setLanguage($lang)->setCuType($cutype)->setRole($role)->setPartStat(ParticipationStatus::ACCEPT())->setRsvp(true)->setMember($member)->setDelegatedTo($delTo)->setDelegatedFrom($delFrom);
     $this->assertSame($address, $cal->getAddress());
     $this->assertSame($url, $cal->getUrl());
     $this->assertSame($displayName, $cal->getDisplayName());
     $this->assertSame($sentBy, $cal->getSentBy());
     $this->assertSame($dir, $cal->getDir());
     $this->assertSame($lang, $cal->getLanguage());
     $this->assertSame($cutype, $cal->getCuType());
     $this->assertSame($role, $cal->getRole());
     $this->assertTrue($cal->getPartStat()->is('AC'));
     $this->assertTrue($cal->getRsvp());
     $this->assertSame($member, $cal->getMember());
     $this->assertSame($delTo, $cal->getDelegatedTo());
     $this->assertSame($delFrom, $cal->getDelegatedFrom());
     $xml = '<?xml version="1.0"?>' . "\n" . '<at a="' . $address . '" url="' . $url . '" d="' . $displayName . '" sentBy="' . $sentBy . '" dir="' . $dir . '" lang="' . $lang . '" cutype="' . $cutype . '" role="' . $role . '" ptst="' . ParticipationStatus::ACCEPT() . '" rsvp="true" member="' . $member . '" delTo="' . $delTo . '" delFrom="' . $delFrom . '">' . '<xparam name="' . $name1 . '" value="' . $value1 . '" />' . '<xparam name="' . $name2 . '" value="' . $value2 . '" />' . '</at>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $cal);
     $array = array('at' => array('a' => $address, 'url' => $url, 'd' => $displayName, 'sentBy' => $sentBy, 'dir' => $dir, 'lang' => $lang, 'cutype' => $cutype, 'role' => $role, 'ptst' => ParticipationStatus::ACCEPT()->value(), 'rsvp' => true, 'member' => $member, 'delTo' => $delTo, 'delFrom' => $delFrom, 'xparam' => array(array('name' => $name1, 'value' => $value1), array('name' => $name2, 'value' => $value2))));
     $this->assertEquals($array, $cal->toArray());
 }
 public function testSetCalendarItemInfo()
 {
     $m = new Msg();
     $item = new SetCalendarItemInfo($m, ParticipationStatus::NEEDS_ACTION());
     $this->assertSame($m, $item->getMsg());
     $this->assertTrue($item->getPartStat()->is('NE'));
     $item = new SetCalendarItemInfo();
     $item->setMsg($m)->setPartStat(ParticipationStatus::NEEDS_ACTION());
     $this->assertSame($m, $item->getMsg());
     $this->assertTrue($item->getPartStat()->is('NE'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<item ptst="' . ParticipationStatus::NEEDS_ACTION() . '">' . '<m />' . '</item>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $item);
     $array = array('item' => array('ptst' => ParticipationStatus::NEEDS_ACTION()->value(), 'm' => array()));
     $this->assertEquals($array, $item->toArray());
 }
 public function testAddAppointmentInviteApi()
 {
     $content = $this->faker->word;
     $fr = $this->faker->word;
     $aid = $this->faker->uuid;
     $origid = $this->faker->uuid;
     $idnt = $this->faker->word;
     $su = $this->faker->word;
     $irt = $this->faker->word;
     $l = $this->faker->word;
     $f = $this->faker->word;
     $m = new Msg($content, NULL, NULL, NULL, $fr, $aid, $origid, ReplyType::REPLIED(), $idnt, $su, $irt, $l, $f);
     $this->api->addAppointmentInvite($m, ParticipationStatus::NEEDS_ACTION());
     $client = $this->api->getClient();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:AddAppointmentInviteRequest ptst="' . ParticipationStatus::NEEDS_ACTION() . '">' . '<urn1:m aid="' . $aid . '" origid="' . $origid . '" rt="' . ReplyType::REPLIED() . '" idnt="' . $idnt . '" su="' . $su . '" irt="' . $irt . '" l="' . $l . '" f="' . $f . '">' . '<urn1:content>' . $content . '</urn1:content>' . '<urn1:fr>' . $fr . '</urn1:fr>' . '</urn1:m>' . '</urn1:AddAppointmentInviteRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #5
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());
 }
Example #6
0
 public function testParticipationStatus()
 {
     $values = array('NE', 'AC', 'TE', 'DE', 'DG', 'CO', 'IN', 'WE', 'DF');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\ParticipationStatus::has($value));
     }
 }
Example #7
0
 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());
 }
Example #8
0
 public function testSetTask()
 {
     $m = $this->getMsg();
     $default = new \Zimbra\Mail\Struct\SetCalendarItemInfo($m, ParticipationStatus::NE());
     $except = new \Zimbra\Mail\Struct\SetCalendarItemInfo();
     $cancel = new \Zimbra\Mail\Struct\SetCalendarItemInfo();
     $reply = new \Zimbra\Mail\Struct\CalReply('at', 10, 10, 10, '991231', 'sentBy', ParticipationStatus::NE(), 'tz', '991231000000');
     $replies = new \Zimbra\Mail\Struct\Replies(array($reply));
     $this->_api->setTask($default, array($except), array($cancel), $replies, 'f', 't', 'tn', 'l', true, 10);
     $client = $this->_api->client();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:SetTaskRequest f="f" t="t" tn="tn" l="l" noNextAlarm="true" nextAlarm="10">' . '<urn1:default ptst="NE">' . '<urn1:m aid="aid" origid="origid" rt="rt" idnt="idnt" su="su" irt="irt" l="l" f="f">' . '<urn1:content>content</urn1:content>' . '<urn1:mp ct="ct" content="content" ci="ci">' . '<urn1:attach aid="aid">' . '<urn1:mp optional="true" mid="mid" part="part" />' . '<urn1:m optional="false" id="id" />' . '<urn1:cn optional="false" id="id" />' . '<urn1:doc optional="true" path="path" id="id" ver="10" />' . '</urn1:attach>' . '<urn1:mp ct="ct" content="content" ci="ci" />' . '</urn1:mp>' . '<urn1:attach aid="aid">' . '<urn1:mp optional="true" mid="mid" part="part" />' . '<urn1:m optional="false" id="id" />' . '<urn1:cn optional="false" id="id" />' . '<urn1:doc optional="true" path="path" id="id" ver="10" />' . '</urn1:attach>' . '<urn1:inv method="method" compNum="10" rsvp="true" />' . '<urn1:fr>fr</urn1:fr>' . '<urn1:header name="name">value</urn1:header>' . '<urn1:e a="a" t="t" p="p" />' . '<urn1:tz id="id" stdoff="10" dayoff="10" stdname="stdname" dayname="dayname">' . '<urn1:standard mon="12" hour="2" min="3" sec="4" />' . '<urn1:daylight mon="4" hour="3" min="2" sec="10" />' . '</urn1:tz>' . '</urn1:m>' . '</urn1:default>' . '<urn1:replies>' . '<urn1:reply at="at" seq="10" d="10" sentBy="sentBy" ptst="NE" rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '</urn1:replies>' . '<urn1:except />' . '<urn1:cancel />' . '</urn1:SetTaskRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #9
0
 public function testSetCalendarItemInfo()
 {
     $mp = new \Zimbra\Mail\Struct\MimePartAttachSpec('mid', 'part', true);
     $msg = new \Zimbra\Mail\Struct\MsgAttachSpec('id', false);
     $cn = new \Zimbra\Mail\Struct\ContactAttachSpec('id', false);
     $doc = new \Zimbra\Mail\Struct\DocAttachSpec('path', 'id', 10, true);
     $info = new \Zimbra\Mail\Struct\MimePartInfo(array(), null, 'ct', 'content', 'ci');
     $standard = new \Zimbra\Struct\TzOnsetInfo(12, 2, 3, 4);
     $daylight = new \Zimbra\Struct\TzOnsetInfo(4, 3, 2, 10);
     $header = new \Zimbra\Mail\Struct\Header('name', 'value');
     $attach = new \Zimbra\Mail\Struct\AttachmentsInfo($mp, $msg, $cn, $doc, 'aid');
     $mp = new \Zimbra\Mail\Struct\MimePartInfo(array($info), $attach, 'ct', 'content', 'ci');
     $inv = new \Zimbra\Mail\Struct\InvitationInfo('method', 10, true);
     $e = new \Zimbra\Mail\Struct\EmailAddrInfo('a', 't', 'p');
     $tz = new \Zimbra\Mail\Struct\CalTZInfo('id', 10, 10, $standard, $daylight, 'stdname', 'dayname');
     $m = new \Zimbra\Mail\Struct\Msg('content', array($header), $mp, $attach, $inv, array($e), array($tz), 'fr', 'aid', 'origid', 'rt', 'idnt', 'su', 'irt', 'l', 'f');
     $item = new \Zimbra\Mail\Struct\SetCalendarItemInfo($m, ParticipationStatus::NE());
     $this->assertSame($m, $item->m());
     $this->assertTrue($item->ptst()->is('NE'));
     $item->m($m)->ptst(ParticipationStatus::NE());
     $this->assertSame($m, $item->m());
     $this->assertTrue($item->ptst()->is('NE'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<item ptst="NE">' . '<m aid="aid" origid="origid" rt="rt" idnt="idnt" su="su" irt="irt" l="l" f="f">' . '<content>content</content>' . '<mp ct="ct" content="content" ci="ci">' . '<attach aid="aid">' . '<mp optional="true" mid="mid" part="part" />' . '<m optional="false" id="id" />' . '<cn optional="false" id="id" />' . '<doc optional="true" path="path" id="id" ver="10" />' . '</attach>' . '<mp ct="ct" content="content" ci="ci" />' . '</mp>' . '<attach aid="aid">' . '<mp optional="true" mid="mid" part="part" />' . '<m optional="false" id="id" />' . '<cn optional="false" id="id" />' . '<doc optional="true" path="path" id="id" ver="10" />' . '</attach>' . '<inv method="method" compNum="10" rsvp="true" />' . '<fr>fr</fr>' . '<header name="name">value</header>' . '<e a="a" t="t" p="p" />' . '<tz id="id" stdoff="10" dayoff="10" stdname="stdname" dayname="dayname">' . '<standard mon="12" hour="2" min="3" sec="4" />' . '<daylight mon="4" hour="3" min="2" sec="10" />' . '</tz>' . '</m>' . '</item>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $item);
     $array = array('item' => array('ptst' => 'NE', 'm' => array('aid' => 'aid', 'origid' => 'origid', 'rt' => 'rt', 'idnt' => 'idnt', 'su' => 'su', 'irt' => 'irt', 'l' => 'l', 'f' => 'f', 'content' => 'content', 'header' => array(array('name' => 'name', '_content' => 'value')), 'mp' => array('ct' => 'ct', 'content' => 'content', 'ci' => 'ci', 'mp' => array(array('ct' => 'ct', 'content' => 'content', 'ci' => 'ci')), 'attach' => array('aid' => 'aid', 'mp' => array('mid' => 'mid', 'part' => 'part', 'optional' => true), 'm' => array('id' => 'id', 'optional' => false), 'cn' => array('id' => 'id', 'optional' => false), 'doc' => array('path' => 'path', 'id' => 'id', 'ver' => 10, 'optional' => true))), 'attach' => array('aid' => 'aid', 'mp' => array('mid' => 'mid', 'part' => 'part', 'optional' => true), 'm' => array('id' => 'id', 'optional' => false), 'cn' => array('id' => 'id', 'optional' => false), 'doc' => array('path' => 'path', 'id' => 'id', 'ver' => 10, 'optional' => true)), 'inv' => array('method' => 'method', 'compNum' => 10, 'rsvp' => true), 'e' => array(array('a' => 'a', 't' => 't', 'p' => 'p')), 'tz' => array(array('id' => 'id', 'stdoff' => 10, 'dayoff' => 10, 'stdname' => 'stdname', 'dayname' => 'dayname', 'standard' => array('mon' => 12, 'hour' => 2, 'min' => 3, 'sec' => 4), 'daylight' => array('mon' => 4, 'hour' => 3, 'min' => 2, 'sec' => 10))), 'fr' => 'fr')));
     $this->assertEquals($array, $item->toArray());
 }
Example #10
0
 public function testSetAppointmentApi()
 {
     $content = $this->faker->word;
     $fr = $this->faker->word;
     $aid = $this->faker->uuid;
     $origid = $this->faker->uuid;
     $idnt = $this->faker->word;
     $su = $this->faker->word;
     $irt = $this->faker->word;
     $l = $this->faker->word;
     $f = $this->faker->word;
     $attendee = $this->faker->word;
     $sequence = mt_rand(1, 100);
     $date = mt_rand(1, 100);
     $rangeType = mt_rand(1, 100);
     $recurId = $this->faker->iso8601;
     $sentBy = $this->faker->word;
     $tz = $this->faker->word;
     $ridZ = $this->faker->iso8601;
     $t = $this->faker->word;
     $tn = $this->faker->word;
     $l = $this->faker->word;
     $nextAlarm = mt_rand(1, 10);
     $m = new Msg($content, NULL, NULL, NULL, $fr, $aid, $origid, ReplyType::REPLIED(), $idnt, $su, $irt, $l, $f);
     $default = new SetCalendarItemInfo($m, ParticipationStatus::NEEDS_ACTION());
     $except = new SetCalendarItemInfo();
     $cancel = new SetCalendarItemInfo();
     $reply = new CalReply($attendee, $sequence, $date, $rangeType, $recurId, $sentBy, ParticipationStatus::NEEDS_ACTION(), $tz, $ridZ);
     $replies = new Replies([$reply]);
     $this->api->setAppointment($f, $t, $tn, $l, true, $nextAlarm, $default, [$except], [$cancel], $replies);
     $client = $this->api->getClient();
     $req = $client->lastRequest();
     $xml = '<?xml version="1.0"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">' . '<env:Body>' . '<urn1:SetAppointmentRequest f="' . $f . '" t="' . $t . '" tn="' . $tn . '" l="' . $l . '" noNextAlarm="true" nextAlarm="' . $nextAlarm . '">' . '<urn1:default ptst="' . ParticipationStatus::NEEDS_ACTION() . '">' . '<urn1:m aid="' . $aid . '" origid="' . $origid . '" rt="' . ReplyType::REPLIED() . '" idnt="' . $idnt . '" su="' . $su . '" irt="' . $irt . '" l="' . $l . '" f="' . $f . '">' . '<urn1:content>' . $content . '</urn1:content>' . '<urn1:fr>' . $fr . '</urn1:fr>' . '</urn1:m>' . '</urn1:default>' . '<urn1:replies>' . '<urn1:reply at="' . $attendee . '" seq="' . $sequence . '" d="' . $date . '" sentBy="' . $sentBy . '" ptst="' . ParticipationStatus::NEEDS_ACTION() . '" rangeType="' . $rangeType . '" recurId="' . $recurId . '" tz="' . $tz . '" ridZ="' . $ridZ . '" />' . '</urn1:replies>' . '<urn1:except />' . '<urn1:cancel />' . '</urn1:SetAppointmentRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #11
0
 public function testSetAppointment()
 {
     $m = $this->getMsg();
     $default = new \Zimbra\Mail\Struct\SetCalendarItemInfo($m, ParticipationStatus::NE());
     $except = new \Zimbra\Mail\Struct\SetCalendarItemInfo();
     $cancel = new \Zimbra\Mail\Struct\SetCalendarItemInfo();
     $reply = new \Zimbra\Mail\Struct\CalReply('at', 10, 10, 10, '991231', 'sentBy', ParticipationStatus::NE(), 'tz', '991231000000');
     $replies = new \Zimbra\Mail\Struct\Replies(array($reply));
     $req = new \Zimbra\Mail\Request\SetAppointment($default, array($except), array($cancel), $replies, 'f', 't', 'tn', 'l', true, 10);
     $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req);
     $this->assertSame($default, $req->default_());
     $this->assertSame(array($except), $req->except()->all());
     $this->assertSame(array($cancel), $req->cancel()->all());
     $this->assertSame($replies, $req->replies());
     $this->assertSame('f', $req->f());
     $this->assertSame('t', $req->t());
     $this->assertSame('tn', $req->tn());
     $this->assertSame('l', $req->l());
     $this->assertTrue($req->noNextAlarm());
     $this->assertSame(10, $req->nextAlarm());
     $req->default_($default)->addExcept($except)->addCancel($cancel)->replies($replies)->f('f')->t('t')->tn('tn')->l('l')->noNextAlarm(true)->nextAlarm(10);
     $this->assertSame($default, $req->default_());
     $this->assertSame(array($except, $except), $req->except()->all());
     $this->assertSame(array($cancel, $cancel), $req->cancel()->all());
     $this->assertSame($replies, $req->replies());
     $this->assertSame('f', $req->f());
     $this->assertSame('t', $req->t());
     $this->assertSame('tn', $req->tn());
     $this->assertSame('l', $req->l());
     $this->assertTrue($req->noNextAlarm());
     $this->assertSame(10, $req->nextAlarm());
     $xml = '<?xml version="1.0"?>' . "\n" . '<SetAppointmentRequest f="f" t="t" tn="tn" l="l" noNextAlarm="true" nextAlarm="10">' . '<default ptst="NE">' . '<m aid="aid" origid="origid" rt="rt" idnt="idnt" su="su" irt="irt" l="l" f="f">' . '<content>content</content>' . '<mp ct="ct" content="content" ci="ci">' . '<attach aid="aid">' . '<mp optional="true" mid="mid" part="part" />' . '<m optional="false" id="id" />' . '<cn optional="false" id="id" />' . '<doc optional="true" path="path" id="id" ver="10" />' . '</attach>' . '<mp ct="ct" content="content" ci="ci" />' . '</mp>' . '<attach aid="aid">' . '<mp optional="true" mid="mid" part="part" />' . '<m optional="false" id="id" />' . '<cn optional="false" id="id" />' . '<doc optional="true" path="path" id="id" ver="10" />' . '</attach>' . '<inv method="method" compNum="10" rsvp="true" />' . '<fr>fr</fr>' . '<header name="name">value</header>' . '<e a="a" t="t" p="p" />' . '<tz id="id" stdoff="10" dayoff="10" stdname="stdname" dayname="dayname">' . '<standard mon="12" hour="2" min="3" sec="4" />' . '<daylight mon="4" hour="3" min="2" sec="10" />' . '</tz>' . '</m>' . '</default>' . '<replies>' . '<reply at="at" seq="10" d="10" sentBy="sentBy" ptst="NE" rangeType="10" recurId="991231" tz="tz" ridZ="991231000000" />' . '</replies>' . '<except /><except />' . '<cancel /><cancel />' . '</SetAppointmentRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('SetAppointmentRequest' => array('_jsns' => 'urn:zimbraMail', 'f' => 'f', 't' => 't', 'tn' => 'tn', 'l' => 'l', 'noNextAlarm' => true, 'nextAlarm' => 10, 'default' => array('ptst' => 'NE', 'm' => array('aid' => 'aid', 'origid' => 'origid', 'rt' => 'rt', 'idnt' => 'idnt', 'su' => 'su', 'irt' => 'irt', 'l' => 'l', 'f' => 'f', 'content' => 'content', 'header' => array(array('name' => 'name', '_content' => 'value')), 'mp' => array('ct' => 'ct', 'content' => 'content', 'ci' => 'ci', 'mp' => array(array('ct' => 'ct', 'content' => 'content', 'ci' => 'ci')), 'attach' => array('aid' => 'aid', 'mp' => array('mid' => 'mid', 'part' => 'part', 'optional' => true), 'm' => array('id' => 'id', 'optional' => false), 'cn' => array('id' => 'id', 'optional' => false), 'doc' => array('path' => 'path', 'id' => 'id', 'ver' => 10, 'optional' => true))), 'attach' => array('aid' => 'aid', 'mp' => array('mid' => 'mid', 'part' => 'part', 'optional' => true), 'm' => array('id' => 'id', 'optional' => false), 'cn' => array('id' => 'id', 'optional' => false), 'doc' => array('path' => 'path', 'id' => 'id', 'ver' => 10, 'optional' => true)), 'inv' => array('method' => 'method', 'compNum' => 10, 'rsvp' => true), 'e' => array(array('a' => 'a', 't' => 't', 'p' => 'p')), 'tz' => array(array('id' => 'id', 'stdoff' => 10, 'dayoff' => 10, 'stdname' => 'stdname', 'dayname' => 'dayname', 'standard' => array('mon' => 12, 'hour' => 2, 'min' => 3, 'sec' => 4), 'daylight' => array('mon' => 4, 'hour' => 3, 'min' => 2, 'sec' => 10))), 'fr' => 'fr')), 'except' => array(array(), array()), 'cancel' => array(array(), array()), 'replies' => array('reply' => array(array('at' => 'at', 'seq' => 10, 'd' => 10, 'sentBy' => 'sentBy', 'ptst' => 'NE', 'rangeType' => 10, 'recurId' => '991231', 'tz' => 'tz', 'ridZ' => '991231000000')))));
     $this->assertEquals($array, $req->toArray());
 }