public function testNewMountpointSpec()
 {
     $name = $this->faker->word;
     $f = $this->faker->uuid;
     $rgb = $this->faker->hexcolor;
     $url = $this->faker->word;
     $l = $this->faker->word;
     $zid = $this->faker->uuid;
     $owner = $this->faker->word;
     $path = $this->faker->word;
     $color = mt_rand(1, 127);
     $rid = mt_rand(1, 10);
     $link = new NewMountpointSpec($name, SearchType::TASK(), $f, $color, $rgb, $url, $l, true, true, $zid, $owner, $rid, $path);
     $this->assertSame($name, $link->getName());
     $this->assertTrue($link->getView()->is('task'));
     $this->assertSame($f, $link->getFlags());
     $this->assertSame($color, $link->getColor());
     $this->assertSame($rgb, $link->getRgb());
     $this->assertSame($url, $link->getUrl());
     $this->assertSame($l, $link->getParentFolderId());
     $this->assertTrue($link->getFetchIfExists());
     $this->assertTrue($link->getReminderEnabled());
     $this->assertSame($zid, $link->getOwnerId());
     $this->assertSame($owner, $link->getOwnerName());
     $this->assertSame($rid, $link->getRemoteId());
     $this->assertSame($path, $link->getPath());
     $link = new NewMountpointSpec('name');
     $link->setName($name)->setView(SearchType::TASK())->setFlags($f)->setColor($color)->setRgb($rgb)->setUrl($url)->setParentFolderId($l)->setFetchIfExists(true)->setReminderEnabled(true)->setOwnerId($zid)->setOwnerName($owner)->setRemoteId($rid)->setPath($path);
     $this->assertSame($name, $link->getName());
     $this->assertTrue($link->getView()->is('task'));
     $this->assertSame($f, $link->getFlags());
     $this->assertSame($color, $link->getColor());
     $this->assertSame($rgb, $link->getRgb());
     $this->assertSame($url, $link->getUrl());
     $this->assertSame($l, $link->getParentFolderId());
     $this->assertTrue($link->getFetchIfExists());
     $this->assertTrue($link->getReminderEnabled());
     $this->assertSame($zid, $link->getOwnerId());
     $this->assertSame($owner, $link->getOwnerName());
     $this->assertSame($rid, $link->getRemoteId());
     $this->assertSame($path, $link->getPath());
     $xml = '<?xml version="1.0"?>' . "\n" . '<link name="' . $name . '" view="' . SearchType::TASK() . '" f="' . $f . '" color="' . $color . '" rgb="' . $rgb . '" url="' . $url . '" l="' . $l . '" fie="true" reminder="true" zid="' . $zid . '" owner="' . $owner . '" rid="' . $rid . '" path="' . $path . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $link);
     $array = array('link' => array('name' => $name, 'view' => SearchType::TASK()->value(), 'f' => $f, 'color' => $color, 'rgb' => $rgb, 'url' => $url, 'l' => $l, 'fie' => true, 'reminder' => true, 'zid' => $zid, 'owner' => $owner, 'rid' => $rid, 'path' => $path));
     $this->assertEquals($array, $link->toArray());
 }
 public function testNewFolderSpec()
 {
     $rights = $this->faker->word;
     $zimbraId = $this->faker->uuid;
     $displayName = $this->faker->word;
     $args = $this->faker->word;
     $password = $this->faker->word;
     $accessKey = $this->faker->word;
     $name = $this->faker->word;
     $f = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $url = $this->faker->word;
     $l = $this->faker->word;
     $color = mt_rand(1, 127);
     $grant = new ActionGrantSelector($rights, GranteeType::USR(), $zimbraId, $displayName, $args, $password, $accessKey);
     $acl = new NewFolderSpecAcl([$grant]);
     $folder = new NewFolderSpec($name, SearchType::TASK(), $f, $color, $rgb, $url, $l, true, true, $acl);
     $this->assertSame($name, $folder->getName());
     $this->assertSame($acl, $folder->getGrants());
     $this->assertTrue($folder->getView()->is('task'));
     $this->assertSame($f, $folder->getFlags());
     $this->assertSame($color, $folder->getColor());
     $this->assertSame($rgb, $folder->getRgb());
     $this->assertSame($url, $folder->getUrl());
     $this->assertSame($l, $folder->getParentFolderId());
     $this->assertTrue($folder->getFetchIfExists());
     $this->assertTrue($folder->getSyncToUrl());
     $folder = new NewFolderSpec('name');
     $folder->setName($name)->setGrants($acl)->setView(SearchType::TASK())->setFlags($f)->setColor($color)->setRgb($rgb)->setUrl($url)->setParentFolderId($l)->setFetchIfExists(true)->setSyncToUrl(true);
     $this->assertSame($name, $folder->getName());
     $this->assertSame($acl, $folder->getGrants());
     $this->assertTrue($folder->getView()->is('task'));
     $this->assertSame($f, $folder->getFlags());
     $this->assertSame($color, $folder->getColor());
     $this->assertSame($rgb, $folder->getRgb());
     $this->assertSame($url, $folder->getUrl());
     $this->assertSame($l, $folder->getParentFolderId());
     $this->assertTrue($folder->getFetchIfExists());
     $this->assertTrue($folder->getSyncToUrl());
     $xml = '<?xml version="1.0"?>' . "\n" . '<folder name="' . $name . '" view="' . SearchType::TASK() . '" f="' . $f . '" color="' . $color . '" rgb="' . $rgb . '" url="' . $url . '" l="' . $l . '" fie="true" sync="true">' . '<acl>' . '<grant perm="' . $rights . '" gt="' . GranteeType::USR() . '" zid="' . $zimbraId . '" d="' . $displayName . '" args="' . $args . '" pw="' . $password . '" key="' . $accessKey . '" />' . '</acl>' . '</folder>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $folder);
     $array = array('folder' => array('name' => $name, 'view' => SearchType::TASK()->value(), 'f' => $f, 'color' => $color, 'rgb' => $rgb, 'url' => $url, 'l' => $l, 'fie' => true, 'sync' => true, 'acl' => array('grant' => array(array('perm' => $rights, 'gt' => GranteeType::USR()->value(), 'zid' => $zimbraId, 'd' => $displayName, 'args' => $args, 'pw' => $password, 'key' => $accessKey)))));
     $this->assertEquals($array, $folder->toArray());
 }
 public function testCreateMountpointApi()
 {
     $name = $this->faker->word;
     $f = $this->faker->uuid;
     $rgb = $this->faker->hexcolor;
     $url = $this->faker->word;
     $l = $this->faker->word;
     $zid = $this->faker->uuid;
     $owner = $this->faker->word;
     $path = $this->faker->word;
     $color = mt_rand(1, 127);
     $rid = mt_rand(1, 10);
     $link = new NewMountpointSpec($name, SearchType::TASK(), $f, $color, $rgb, $url, $l, true, true, $zid, $owner, $rid, $path);
     $this->api->createMountpoint($link);
     $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:CreateMountpointRequest>' . '<urn1:link name="' . $name . '" view="' . SearchType::TASK() . '" f="' . $f . '" color="' . $color . '" rgb="' . $rgb . '" url="' . $url . '" l="' . $l . '" fie="true" reminder="true" zid="' . $zid . '" owner="' . $owner . '" rid="' . $rid . '" path="' . $path . '" />' . '</urn1:CreateMountpointRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemple #4
0
 public function testCreateFolderApi()
 {
     $rights = $this->faker->word;
     $zimbraId = $this->faker->uuid;
     $displayName = $this->faker->word;
     $args = $this->faker->word;
     $password = $this->faker->word;
     $accessKey = $this->faker->word;
     $name = $this->faker->word;
     $f = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $url = $this->faker->word;
     $l = $this->faker->word;
     $color = mt_rand(1, 127);
     $grant = new ActionGrantSelector($rights, GranteeType::USR(), $zimbraId, $displayName, $args, $password, $accessKey);
     $acl = new NewFolderSpecAcl([$grant]);
     $folder = new NewFolderSpec($name, SearchType::TASK(), $f, $color, $rgb, $url, $l, true, true, $acl);
     $this->api->createFolder($folder);
     $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:CreateFolderRequest>' . '<urn1:folder name="' . $name . '" view="' . SearchType::TASK() . '" f="' . $f . '" color="' . $color . '" rgb="' . $rgb . '" url="' . $url . '" l="' . $l . '" fie="true" sync="true">' . '<urn1:acl>' . '<urn1:grant perm="' . $rights . '" gt="' . GranteeType::USR() . '" zid="' . $zimbraId . '" d="' . $displayName . '" args="' . $args . '" pw="' . $password . '" key="' . $accessKey . '" />' . '</urn1:acl>' . '</urn1:folder>' . '</urn1:CreateFolderRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemple #5
0
 public function testSearchType()
 {
     $values = array('conversation', 'message', 'contact', 'appointment', 'task', 'wiki', 'document');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\SearchType::has($value));
     }
 }
Exemple #6
0
 public function testCreateMountpoint()
 {
     $link = new \Zimbra\Mail\Struct\NewMountpointSpec('name', SearchType::TASK(), 'f', 10, '#aabbcc', 'url', 'l', true, true, 'zid', 'owner', 10, 'path');
     $this->_api->createMountpoint($link);
     $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:CreateMountpointRequest>' . '<urn1:link name="name" view="task" f="f" color="10" rgb="#aabbcc" url="url" l="l" fie="true" reminder="true" zid="zid" owner="owner" rid="10" path="path" />' . '</urn1:CreateMountpointRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemple #7
0
 public function testNewMountpointSpec()
 {
     $link = new \Zimbra\Mail\Struct\NewMountpointSpec('name', SearchType::TASK(), 'f', 10, '#aabbcc', 'url', 'l', true, true, 'zid', 'owner', 10, 'path');
     $this->assertSame('name', $link->name());
     $this->assertTrue($link->view()->is('task'));
     $this->assertSame('f', $link->f());
     $this->assertSame(10, $link->color());
     $this->assertSame('#aabbcc', $link->rgb());
     $this->assertSame('url', $link->url());
     $this->assertSame('l', $link->l());
     $this->assertTrue($link->fie());
     $this->assertTrue($link->reminder());
     $this->assertSame('zid', $link->zid());
     $this->assertSame('owner', $link->owner());
     $this->assertSame(10, $link->rid());
     $this->assertSame('path', $link->path());
     $link->name('name')->view(SearchType::TASK())->f('f')->color(10)->rgb('#aabbcc')->url('url')->l('l')->fie(true)->reminder(true)->zid('zid')->owner('owner')->rid(10)->path('path');
     $this->assertSame('name', $link->name());
     $this->assertTrue($link->view()->is('task'));
     $this->assertSame('f', $link->f());
     $this->assertSame(10, $link->color());
     $this->assertSame('#aabbcc', $link->rgb());
     $this->assertSame('url', $link->url());
     $this->assertSame('l', $link->l());
     $this->assertTrue($link->fie());
     $this->assertTrue($link->reminder());
     $this->assertSame('zid', $link->zid());
     $this->assertSame('owner', $link->owner());
     $this->assertSame(10, $link->rid());
     $this->assertSame('path', $link->path());
     $xml = '<?xml version="1.0"?>' . "\n" . '<link name="name" view="task" f="f" color="10" rgb="#aabbcc" url="url" l="l" fie="true" reminder="true" zid="zid" owner="owner" rid="10" path="path" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $link);
     $array = array('link' => array('name' => 'name', 'view' => 'task', 'f' => 'f', 'color' => 10, 'rgb' => '#aabbcc', 'url' => 'url', 'l' => 'l', 'fie' => true, 'reminder' => true, 'zid' => 'zid', 'owner' => 'owner', 'rid' => 10, 'path' => 'path'));
     $this->assertEquals($array, $link->toArray());
 }
 public function testCreateMountpoint()
 {
     $link = new \Zimbra\Mail\Struct\NewMountpointSpec('name', SearchType::TASK(), 'f', 10, '#aabbcc', 'url', 'l', true, true, 'zid', 'owner', 10, 'path');
     $req = new \Zimbra\Mail\Request\CreateMountpoint($link);
     $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req);
     $this->assertSame($link, $req->link());
     $req->link($link);
     $this->assertSame($link, $req->link());
     $xml = '<?xml version="1.0"?>' . "\n" . '<CreateMountpointRequest>' . '<link name="name" view="task" f="f" color="10" rgb="#aabbcc" url="url" l="l" fie="true" reminder="true" zid="zid" owner="owner" rid="10" path="path" />' . '</CreateMountpointRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('CreateMountpointRequest' => array('_jsns' => 'urn:zimbraMail', 'link' => array('name' => 'name', 'view' => 'task', 'f' => 'f', 'color' => 10, 'rgb' => '#aabbcc', 'url' => 'url', 'l' => 'l', 'fie' => true, 'reminder' => true, 'zid' => 'zid', 'owner' => 'owner', 'rid' => 10, 'path' => 'path')));
     $this->assertEquals($array, $req->toArray());
 }