Exemplo n.º 1
0
 public function testNoteActionSelector()
 {
     $id = $this->faker->uuid;
     $tcon = $this->faker->word;
     $l = $this->faker->word;
     $rgb = $this->faker->hexcolor;
     $name = $this->faker->word;
     $f = $this->faker->word;
     $t = $this->faker->word;
     $tn = $this->faker->word;
     $content = $this->faker->word;
     $pos = $this->faker->word;
     $tag = mt_rand(1, 10);
     $color = mt_rand(1, 127);
     $action = new NoteActionSelector(ItemActionOp::MOVE(), $id, $tcon, $tag, $l, $rgb, $color, $name, $f, $t, $tn, $content, $pos);
     $this->assertInstanceOf('\\Zimbra\\Mail\\Struct\\ActionSelector', $action);
     $this->assertTrue($action->getOperation()->is('move'));
     $this->assertSame($content, $action->getContent());
     $this->assertSame($pos, $action->getBounds());
     $action = new NoteActionSelector(ItemActionOp::DELETE(), $id, $tcon, $tag, $l, $rgb, $color, $name, $f, $t, $tn, '', '');
     $action->setOperation(ItemActionOp::MOVE())->setContent($content)->setBounds($pos);
     $this->assertTrue($action->getOperation()->is('move'));
     $this->assertSame($content, $action->getContent());
     $this->assertSame($pos, $action->getBounds());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . ItemActionOp::MOVE() . '" id="' . $id . '" tcon="' . $tcon . '" l="' . $l . '" rgb="' . $rgb . '" tag="' . $tag . '" color="' . $color . '" name="' . $name . '" f="' . $f . '" t="' . $t . '" tn="' . $tn . '" content="' . $content . '" pos="' . $pos . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => ItemActionOp::MOVE()->value(), 'id' => $id, 'tcon' => $tcon, 'tag' => $tag, 'l' => $l, 'rgb' => $rgb, 'color' => $color, 'name' => $name, 'f' => $f, 't' => $t, 'tn' => $tn, 'content' => $content, 'pos' => $pos));
     $this->assertEquals($array, $action->toArray());
 }
Exemplo n.º 2
0
 public function testItemActionApi()
 {
     $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;
     $action = new ItemActionSelector(ItemActionOp::MOVE(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames);
     $this->api->itemAction($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:ItemActionRequest>' . '<urn1:action op="' . ItemActionOp::MOVE() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '" />' . '</urn1:ItemActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemplo n.º 3
0
 public function testItemActionSelector()
 {
     $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;
     $action = new ItemActionSelector(ItemActionOp::MOVE(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames);
     $this->assertTrue($action->getOperation()->is('move'));
     $this->assertInstanceOf('\\Zimbra\\Mail\\Struct\\ActionSelector', $action);
     $action->setOperation(ItemActionOp::MOVE());
     $this->assertTrue($action->getOperation()->is('move'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . ItemActionOp::MOVE() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => ItemActionOp::MOVE()->value(), 'id' => $id, 'tcon' => $tcon, 'tag' => $tag, 'l' => $folder, 'rgb' => $rgb, 'color' => $color, 'name' => $name, 'f' => $flags, 't' => $tags, 'tn' => $tagNames));
     $this->assertEquals($array, $action->toArray());
 }
Exemplo n.º 4
0
 public function testItemActionOp()
 {
     $values = array('delete', 'dumpsterdelete', 'recover', 'read', 'flag', 'priority', 'tag', 'move', 'trash', 'rename', 'update', 'color', 'lock', 'unlock');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\ItemActionOp::has($value));
     }
 }
Exemplo n.º 5
0
 public function testNoteAction()
 {
     $action = new \Zimbra\Mail\Struct\NoteActionSelector(ItemActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn', 'content', 'pos');
     $this->_api->noteAction($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:NoteActionRequest>' . '<urn1:action op="move" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" content="content" pos="pos" />' . '</urn1:NoteActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemplo n.º 6
0
 public function testNoteActionSelector()
 {
     $action = new \Zimbra\Mail\Struct\NoteActionSelector(ItemActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn', 'content', 'pos');
     $this->assertInstanceOf('\\Zimbra\\Mail\\Struct\\ActionSelector', $action);
     $this->assertTrue($action->op()->is('move'));
     $this->assertSame('content', $action->content());
     $this->assertSame('pos', $action->pos());
     $action->op(ItemActionOp::MOVE())->content('content')->pos('pos');
     $this->assertTrue($action->op()->is('move'));
     $this->assertSame('content', $action->content());
     $this->assertSame('pos', $action->pos());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="move" id="id" tcon="tcon" l="l" rgb="#aabbcc" tag="10" color="10" name="name" f="f" t="t" tn="tn" content="content" pos="pos" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => 'move', 'id' => 'id', 'tcon' => 'tcon', 'tag' => 10, 'l' => 'l', 'rgb' => '#aabbcc', 'color' => 10, 'name' => 'name', 'f' => 'f', 't' => 't', 'tn' => 'tn', 'content' => 'content', 'pos' => 'pos'));
     $this->assertEquals($array, $action->toArray());
 }
Exemplo n.º 7
0
 public function testNoteAction()
 {
     $action = new \Zimbra\Mail\Struct\NoteActionSelector(ItemActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn', 'content', 'pos');
     $req = new \Zimbra\Mail\Request\NoteAction($action);
     $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req);
     $this->assertSame($action, $req->action());
     $req->action($action);
     $this->assertSame($action, $req->action());
     $xml = '<?xml version="1.0"?>' . "\n" . '<NoteActionRequest>' . '<action op="move" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" content="content" pos="pos" />' . '</NoteActionRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('NoteActionRequest' => array('_jsns' => 'urn:zimbraMail', 'action' => array('op' => 'move', 'id' => 'id', 'tcon' => 'tcon', 'tag' => 10, 'l' => 'l', 'rgb' => '#aabbcc', 'color' => 10, 'name' => 'name', 'f' => 'f', 't' => 't', 'tn' => 'tn', 'content' => 'content', 'pos' => 'pos')));
     $this->assertEquals($array, $req->toArray());
 }