Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 public function testFolderActionOp()
 {
     $values = array('read', 'delete', 'rename', 'move', 'trash', 'empty', 'color', 'grant', '!grant', 'revokeorphangrants', 'url', 'import', 'sync', 'fb', 'check', '!check', 'update', 'syncon', '!syncon', 'retentionpolicy', 'disableactivesync', '!disableactivesync');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\FolderActionOp::has($value));
     }
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public function testFolderAction()
 {
     $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);
     $grant = new \Zimbra\Mail\Struct\ActionGrantSelector('perm', GranteeType::USR(), 'zid', 'd', 'args', 'pw', 'key');
     $acl = new \Zimbra\Mail\Struct\FolderActionSelectorAcl(array($grant));
     $action = new \Zimbra\Mail\Struct\FolderActionSelector(FolderActionOp::READ(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn', $grant, $acl, $retentionPolicy, true, 'url', true, 'zid', 'gt', 'view');
     $this->_api->folderAction($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:FolderActionRequest>' . '<urn1:action op="read" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" recursive="true" url="url" excludeFreeBusy="true" zid="zid" gt="gt" view="view">' . '<urn1:grant perm="perm" gt="usr" zid="zid" d="d" args="args" pw="pw" key="key" />' . '<urn1:acl>' . '<urn1:grant perm="perm" gt="usr" zid="zid" d="d" args="args" pw="pw" key="key" />' . '</urn1:acl>' . '<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:FolderActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Ejemplo n.º 5
0
 public function testFolderActionSelector()
 {
     $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);
     $grant = new \Zimbra\Mail\Struct\ActionGrantSelector('perm', GranteeType::USR(), 'zid', 'd', 'args', 'pw', 'key');
     $acl = new \Zimbra\Mail\Struct\FolderActionSelectorAcl(array($grant));
     $action = new \Zimbra\Mail\Struct\FolderActionSelector(FolderActionOp::READ(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn', $grant, $acl, $retentionPolicy, true, 'url', true, 'zid', 'gt', 'view');
     $this->assertTrue($action->op()->is('read'));
     $this->assertSame($grant, $action->grant());
     $this->assertSame($acl, $action->acl());
     $this->assertSame($retentionPolicy, $action->retentionPolicy());
     $this->assertTrue($action->recursive());
     $this->assertSame('url', $action->url());
     $this->assertTrue($action->excludeFreeBusy());
     $this->assertSame('zid', $action->zid());
     $this->assertSame('gt', $action->gt());
     $this->assertSame('view', $action->view());
     $action->op(FolderActionOp::READ())->grant($grant)->acl($acl)->retentionPolicy($retentionPolicy)->recursive(true)->url('url')->excludeFreeBusy(true)->zid('zid')->gt('gt')->view('view');
     $this->assertTrue($action->op()->is('read'));
     $this->assertSame($grant, $action->grant());
     $this->assertSame($acl, $action->acl());
     $this->assertSame($retentionPolicy, $action->retentionPolicy());
     $this->assertTrue($action->recursive());
     $this->assertSame('url', $action->url());
     $this->assertTrue($action->excludeFreeBusy());
     $this->assertSame('zid', $action->zid());
     $this->assertSame('gt', $action->gt());
     $this->assertSame('view', $action->view());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="read" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" recursive="true" url="url" excludeFreeBusy="true" zid="zid" gt="gt" view="view">' . '<grant perm="perm" gt="usr" zid="zid" d="d" args="args" pw="pw" key="key" />' . '<acl>' . '<grant perm="perm" gt="usr" zid="zid" d="d" args="args" pw="pw" key="key" />' . '</acl>' . '<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', 'recursive' => true, 'url' => 'url', 'excludeFreeBusy' => true, 'zid' => 'zid', 'gt' => 'gt', 'view' => 'view', 'grant' => array('perm' => 'perm', 'gt' => 'usr', 'zid' => 'zid', 'd' => 'd', 'args' => 'args', 'pw' => 'pw', 'key' => 'key'), 'acl' => array('grant' => array(array('perm' => 'perm', 'gt' => 'usr', 'zid' => 'zid', 'd' => 'd', 'args' => 'args', 'pw' => 'pw', 'key' => 'key'))), '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());
 }