Example #1
0
 public function testTagActionApi()
 {
     $id = $this->faker->uuid;
     $tcon = $this->faker->word;
     $tag = mt_rand(1, 100);
     $folder = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $color = mt_rand(1, 127);
     $name = $this->faker->word;
     $flags = $this->faker->word;
     $tags = $this->faker->word;
     $tagNames = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $keep = new RetentionPolicyKeep(array($policy));
     $policy = new Policy(Type::USER(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge(array($policy));
     $retention = new RetentionPolicy($keep, $purge);
     $action = new TagActionSelector($retention, TagActionOp::READ(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames);
     $this->api->tagAction($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:TagActionRequest>' . '<urn1:action op="' . TagActionOp::READ() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '">' . '<urn1:retentionPolicy>' . '<urn1:keep>' . '<urn1:policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</urn1:keep>' . '<urn1:purge>' . '<urn1:policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</urn1:purge>' . '</urn1:retentionPolicy>' . '</urn1:action>' . '</urn1:TagActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testTagActionSelector()
 {
     $id = $this->faker->uuid;
     $tcon = $this->faker->word;
     $tag = mt_rand(1, 100);
     $folder = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $color = mt_rand(1, 127);
     $name = $this->faker->word;
     $flags = $this->faker->word;
     $tags = $this->faker->word;
     $tagNames = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $keep = new RetentionPolicyKeep(array($policy));
     $policy = new Policy(Type::USER(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge(array($policy));
     $retention = new RetentionPolicy($keep, $purge);
     $action = new TagActionSelector($retention, TagActionOp::READ(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames);
     $this->assertTrue($action->getOperation()->is('read'));
     $this->assertSame($retention, $action->getRetentionPolicy());
     $action = new TagActionSelector(NULL, TagActionOp::DELETE(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames);
     $action->setOperation(TagActionOp::READ())->setRetentionPolicy($retention);
     $this->assertTrue($action->getOperation()->is('read'));
     $this->assertSame($retention, $action->getRetentionPolicy());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . TagActionOp::READ() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '">' . '<retentionPolicy>' . '<keep>' . '<policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</keep>' . '<purge>' . '<policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</purge>' . '</retentionPolicy>' . '</action>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => TagActionOp::READ()->value(), 'id' => $id, 'tcon' => $tcon, 'tag' => $tag, 'l' => $folder, 'rgb' => $rgb, 'color' => $color, 'name' => $name, 'f' => $flags, 't' => $tags, 'tn' => $tagNames, 'retentionPolicy' => array('keep' => array('policy' => array(array('type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))), 'purge' => array('policy' => array(array('type' => Type::USER()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))))));
     $this->assertEquals($array, $action->toArray());
 }
 public function testFolderActionSelector()
 {
     $id = $this->faker->uuid;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $keep = new RetentionPolicyKeep([$policy]);
     $policy = new Policy(Type::USER(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge([$policy]);
     $retentionPolicy = new RetentionPolicy($keep, $purge);
     $perm = $this->faker->word;
     $zid = $this->faker->uuid;
     $display = $this->faker->word;
     $args = $this->faker->word;
     $pw = $this->faker->word;
     $key = $this->faker->word;
     $grant = new ActionGrantSelector($perm, GranteeType::USR(), $zid, $display, $args, $pw, $key);
     $acl = new FolderActionSelectorAcl([$grant]);
     $tcon = $this->faker->word;
     $tag = mt_rand(1, 100);
     $folder = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $color = mt_rand(1, 127);
     $flags = $this->faker->word;
     $tags = $this->faker->word;
     $tagNames = $this->faker->word;
     $url = $this->faker->word;
     $gt = $this->faker->word;
     $view = $this->faker->word;
     $numDays = mt_rand(1, 100);
     $action = new FolderActionSelector(FolderActionOp::READ(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames, $grant, $acl, $retentionPolicy, true, $url, true, $zid, $gt, $view, $numDays);
     $this->assertTrue($action->getOperation()->is('read'));
     $this->assertSame($grant, $action->getGrant());
     $this->assertSame($acl, $action->getAcl());
     $this->assertSame($retentionPolicy, $action->getRetentionPolicy());
     $this->assertTrue($action->getRecursive());
     $this->assertSame($url, $action->getUrl());
     $this->assertTrue($action->getExcludeFreeBusy());
     $this->assertSame($zid, $action->getZimbraId());
     $this->assertSame($gt, $action->getGrantType());
     $this->assertSame($view, $action->getView());
     $this->assertSame($numDays, $action->getNumDays());
     $action->setOperation(FolderActionOp::READ())->setGrant($grant)->setAcl($acl)->setRetentionPolicy($retentionPolicy)->setRecursive(true)->setUrl($url)->setExcludeFreeBusy(true)->setZimbraId($zid)->setGrantType($gt)->setView($view)->setNumDays($numDays);
     $this->assertTrue($action->getOperation()->is('read'));
     $this->assertSame($grant, $action->getGrant());
     $this->assertSame($acl, $action->getAcl());
     $this->assertSame($retentionPolicy, $action->getRetentionPolicy());
     $this->assertTrue($action->getRecursive());
     $this->assertSame($url, $action->getUrl());
     $this->assertTrue($action->getExcludeFreeBusy());
     $this->assertSame($zid, $action->getZimbraId());
     $this->assertSame($gt, $action->getGrantType());
     $this->assertSame($view, $action->getView());
     $this->assertSame($numDays, $action->getNumDays());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . FolderActionOp::READ() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '" recursive="true" url="' . $url . '" excludeFreeBusy="true" zid="' . $zid . '" gt="' . $gt . '" view="' . $view . '" numDays="' . $numDays . '">' . '<grant perm="' . $perm . '" gt="' . GranteeType::USR() . '" zid="' . $zid . '" d="' . $display . '" args="' . $args . '" pw="' . $pw . '" key="' . $key . '" />' . '<acl>' . '<grant perm="' . $perm . '" gt="' . GranteeType::USR() . '" zid="' . $zid . '" d="' . $display . '" args="' . $args . '" pw="' . $pw . '" key="' . $key . '" />' . '</acl>' . '<retentionPolicy>' . '<keep>' . '<policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</keep>' . '<purge>' . '<policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</purge>' . '</retentionPolicy>' . '</action>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => FolderActionOp::READ()->value(), 'id' => $id, 'tcon' => $tcon, 'tag' => $tag, 'l' => $folder, 'rgb' => $rgb, 'color' => $color, 'name' => $name, 'f' => $flags, 't' => $tags, 'tn' => $tagNames, 'recursive' => true, 'url' => $url, 'excludeFreeBusy' => true, 'zid' => $zid, 'gt' => $gt, 'view' => $view, 'numDays' => $numDays, 'grant' => array('perm' => $perm, 'gt' => GranteeType::USR()->value(), 'zid' => $zid, 'd' => $display, 'args' => $args, 'pw' => $pw, 'key' => $key), 'acl' => array('grant' => array(array('perm' => $perm, 'gt' => GranteeType::USR()->value(), 'zid' => $zid, 'd' => $display, 'args' => $args, 'pw' => $pw, 'key' => $key))), 'retentionPolicy' => array('keep' => array('policy' => array(array('type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))), 'purge' => array('policy' => array(array('type' => Type::USER()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))))));
     $this->assertEquals($array, $action->toArray());
 }
 public function testDeleteSystemRetentionPolicyApi()
 {
     $value = $this->faker->word;
     $id = $this->faker->word;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $cos = new CosSelector(CosBy::NAME(), $value);
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $this->api->deleteSystemRetentionPolicy($policy, $cos);
     $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:zimbraAdmin" xmlns:urn2="urn:zimbraMail">' . '<env:Body>' . '<urn1:DeleteSystemRetentionPolicyRequest>' . '<urn2:policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '<urn1:cos by="' . CosBy::NAME() . '">' . $value . '</urn1:cos>' . '</urn1:DeleteSystemRetentionPolicyRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #5
0
 public function testPolicyHolder()
 {
     $id = $this->faker->word;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $holder = new PolicyHolder($policy);
     $this->assertSame($policy, $holder->getPolicy());
     $holder->setPolicy($policy);
     $this->assertSame($policy, $holder->getPolicy());
     $xml = '<?xml version="1.0"?>' . "\n" . '<holder>' . '<policy xmlns="urn:zimbraMail" type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</holder>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $holder);
     $array = ['holder' => ['policy' => ['_jsns' => 'urn:zimbraMail', 'type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime]]];
     $this->assertEquals($array, $holder->toArray());
 }
 public function testRetentionPolicyPurge()
 {
     $id = $this->faker->uuid;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge([$policy]);
     $this->assertSame([$policy], $purge->getPolicies()->all());
     $purge->addPolicy($policy);
     $this->assertSame([$policy, $policy], $purge->getPolicies()->all());
     $purge = new RetentionPolicyPurge([$policy]);
     $xml = '<?xml version="1.0"?>' . "\n" . '<purge>' . '<policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</purge>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $purge);
     $array = array('purge' => array('policy' => array(array('type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))));
     $this->assertEquals($array, $purge->toArray());
 }
Example #7
0
 public function testRetentionPolicy()
 {
     $id = $this->faker->uuid;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $keep = new RetentionPolicyKeep(array($policy));
     $policy = new Policy(Type::USER(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge(array($policy));
     $retention = new RetentionPolicy($keep, $purge);
     $this->assertSame($keep, $retention->getKeepPolicy());
     $this->assertSame($purge, $retention->getPurgePolicy());
     $retention->setKeepPolicy($keep)->setPurgePolicy($purge);
     $this->assertSame($keep, $retention->getKeepPolicy());
     $this->assertSame($purge, $retention->getPurgePolicy());
     $xml = '<?xml version="1.0"?>' . "\n" . '<retentionPolicy>' . '<keep>' . '<policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</keep>' . '<purge>' . '<policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</purge>' . '</retentionPolicy>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $retention);
     $array = array('retentionPolicy' => array('keep' => array('policy' => array(array('type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime))), 'purge' => array('policy' => array(array('type' => Type::USER()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime)))));
     $this->assertEquals($array, $retention->toArray());
 }
Example #8
0
 public function testPolicy()
 {
     $id = $this->faker->word;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $this->assertSame('system', $policy->getType()->value());
     $this->assertSame($id, $policy->getId());
     $this->assertSame($name, $policy->getName());
     $this->assertSame($lifetime, $policy->getLifetime());
     $policy->setType(Type::USER())->setId($id)->setName($name)->setLifetime($lifetime);
     $this->assertSame('user', $policy->getType()->value());
     $this->assertSame($id, $policy->getId());
     $this->assertSame($name, $policy->getName());
     $this->assertSame($lifetime, $policy->getLifetime());
     $xml = '<?xml version="1.0"?>' . "\n" . '<policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $policy);
     $array = ['policy' => ['_jsns' => 'urn:zimbraMail', 'type' => Type::USER()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime]];
     $this->assertEquals($array, $policy->toArray());
 }
Example #9
0
 public function testType()
 {
     $values = array('user', 'system');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\Type::has($value));
     }
 }
Example #10
0
 public function testFolderActionApi()
 {
     $id = $this->faker->uuid;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $keep = new RetentionPolicyKeep([$policy]);
     $policy = new Policy(Type::USER(), $id, $name, $lifetime);
     $purge = new RetentionPolicyPurge([$policy]);
     $retentionPolicy = new RetentionPolicy($keep, $purge);
     $perm = $this->faker->word;
     $zid = $this->faker->uuid;
     $display = $this->faker->word;
     $args = $this->faker->word;
     $pw = $this->faker->word;
     $key = $this->faker->word;
     $grant = new ActionGrantSelector($perm, GranteeType::USR(), $zid, $display, $args, $pw, $key);
     $acl = new FolderActionSelectorAcl([$grant]);
     $tcon = $this->faker->word;
     $tag = mt_rand(1, 100);
     $folder = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $color = mt_rand(1, 127);
     $flags = $this->faker->word;
     $tags = $this->faker->word;
     $tagNames = $this->faker->word;
     $url = $this->faker->word;
     $gt = $this->faker->word;
     $view = $this->faker->word;
     $numDays = mt_rand(1, 100);
     $action = new FolderActionSelector(FolderActionOp::READ(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames, $grant, $acl, $retentionPolicy, true, $url, true, $zid, $gt, $view, $numDays);
     $this->api->folderAction($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:FolderActionRequest>' . '<urn1:action op="' . FolderActionOp::READ() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '" recursive="true" url="' . $url . '" excludeFreeBusy="true" zid="' . $zid . '" gt="' . $gt . '" view="' . $view . '" numDays="' . $numDays . '">' . '<urn1:grant perm="' . $perm . '" gt="' . GranteeType::USR() . '" zid="' . $zid . '" d="' . $display . '" args="' . $args . '" pw="' . $pw . '" key="' . $key . '" />' . '<urn1:acl>' . '<urn1:grant perm="' . $perm . '" gt="' . GranteeType::USR() . '" zid="' . $zid . '" d="' . $display . '" args="' . $args . '" pw="' . $pw . '" key="' . $key . '" />' . '</urn1:acl>' . '<urn1:retentionPolicy>' . '<urn1:keep>' . '<urn1:policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</urn1:keep>' . '<urn1:purge>' . '<urn1:policy type="' . Type::USER() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '</urn1:purge>' . '</urn1:retentionPolicy>' . '</urn1:action>' . '</urn1:FolderActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #11
0
 public function testTagAction()
 {
     $policy = new \Zimbra\Mail\Struct\Policy(Type::SYSTEM(), 'id', 'name', 'lifetime');
     $keep = new \Zimbra\Mail\Struct\RetentionPolicyKeep(array($policy));
     $policy = new \Zimbra\Mail\Struct\Policy(Type::USER(), 'id', 'name', 'lifetime');
     $purge = new \Zimbra\Mail\Struct\RetentionPolicyPurge(array($policy));
     $retentionPolicy = new \Zimbra\Mail\Struct\RetentionPolicy($keep, $purge);
     $action = new \Zimbra\Mail\Struct\TagActionSelector($retentionPolicy, TagActionOp::READ(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn');
     $this->_api->tagAction($action);
     $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:TagActionRequest>' . '<urn1:action op="read" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn">' . '<urn1:retentionPolicy>' . '<urn1:keep>' . '<urn1:policy type="system" id="id" name="name" lifetime="lifetime" />' . '</urn1:keep>' . '<urn1:purge>' . '<urn1:policy type="user" id="id" name="name" lifetime="lifetime" />' . '</urn1:purge>' . '</urn1:retentionPolicy>' . '</urn1:action>' . '</urn1:TagActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Example #12
0
 public function testModifySystemRetentionPolicy()
 {
     $value = self::randomName();
     $id = self::randomName();
     $name = self::randomName();
     $lifetime = self::randomName();
     $cos = new \Zimbra\Admin\Struct\CosSelector(CosBy::NAME(), $value);
     $policy = new \Zimbra\Admin\Struct\Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $req = new \Zimbra\Admin\Request\ModifySystemRetentionPolicy($policy, $cos);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertSame($policy, $req->getPolicy());
     $this->assertSame($cos, $req->getCos());
     $req->setPolicy($policy)->setCos($cos);
     $this->assertSame($policy, $req->getPolicy());
     $this->assertSame($cos, $req->getCos());
     $xml = '<?xml version="1.0"?>' . "\n" . '<ModifySystemRetentionPolicyRequest>' . '<policy xmlns="urn:zimbraMail" type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '<cos by="' . CosBy::NAME() . '">' . $value . '</cos>' . '</ModifySystemRetentionPolicyRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['ModifySystemRetentionPolicyRequest' => ['_jsns' => 'urn:zimbraAdmin', 'policy' => ['_jsns' => 'urn:zimbraMail', 'type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime], 'cos' => ['by' => CosBy::NAME()->value(), '_content' => $value]]];
     $this->assertEquals($array, $req->toArray());
 }
Example #13
0
 public function testTagActionSelector()
 {
     $policy = new \Zimbra\Mail\Struct\Policy(Type::SYSTEM(), 'id', 'name', 'lifetime');
     $keep = new \Zimbra\Mail\Struct\RetentionPolicyKeep(array($policy));
     $policy = new \Zimbra\Mail\Struct\Policy(Type::USER(), 'id', 'name', 'lifetime');
     $purge = new \Zimbra\Mail\Struct\RetentionPolicyPurge(array($policy));
     $retentionPolicy = new \Zimbra\Mail\Struct\RetentionPolicy($keep, $purge);
     $action = new \Zimbra\Mail\Struct\TagActionSelector($retentionPolicy, TagActionOp::READ(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn');
     $this->assertTrue($action->op()->is('read'));
     $this->assertSame($retentionPolicy, $action->retentionPolicy());
     $action->op(TagActionOp::READ())->retentionPolicy($retentionPolicy);
     $this->assertTrue($action->op()->is('read'));
     $this->assertSame($retentionPolicy, $action->retentionPolicy());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="read" id="id" tcon="tcon" l="l" rgb="#aabbcc" tag="10" color="10" name="name" f="f" t="t" tn="tn">' . '<retentionPolicy>' . '<keep>' . '<policy type="system" id="id" name="name" lifetime="lifetime" />' . '</keep>' . '<purge>' . '<policy type="user" id="id" name="name" lifetime="lifetime" />' . '</purge>' . '</retentionPolicy>' . '</action>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => 'read', 'id' => 'id', 'tcon' => 'tcon', 'tag' => 10, 'l' => 'l', 'rgb' => '#aabbcc', 'color' => 10, 'name' => 'name', 'f' => 'f', 't' => 't', 'tn' => 'tn', 'retentionPolicy' => array('keep' => array('policy' => array(array('type' => 'system', 'id' => 'id', 'name' => 'name', 'lifetime' => 'lifetime'))), 'purge' => array('policy' => array(array('type' => 'user', 'id' => 'id', 'name' => 'name', 'lifetime' => 'lifetime'))))));
     $this->assertEquals($array, $action->toArray());
 }