예제 #1
0
 public function testMsgActionApi()
 {
     $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;
     $tag = mt_rand(1, 10);
     $color = mt_rand(1, 127);
     $action = new MsgActionSelector(MsgActionOp::MOVE(), $id, $tcon, $tag, $l, $rgb, $color, $name, $f, $t, $tn);
     $this->api->msgAction($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:MsgActionRequest>' . '<urn1:action op="' . MsgActionOp::MOVE() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $l . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $f . '" t="' . $t . '" tn="' . $tn . '" />' . '</urn1:MsgActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
예제 #2
0
 public function testMsgActionSelector()
 {
     $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;
     $tag = mt_rand(1, 10);
     $color = mt_rand(1, 127);
     $action = new MsgActionSelector(MsgActionOp::MOVE(), $id, $tcon, $tag, $l, $rgb, $color, $name, $f, $t, $tn);
     $this->assertTrue($action->getOperation()->is('move'));
     $action->setOperation(MsgActionOp::MOVE());
     $this->assertTrue($action->getOperation()->is('move'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . MsgActionOp::MOVE() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $l . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $f . '" t="' . $t . '" tn="' . $tn . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = array('action' => array('op' => MsgActionOp::MOVE()->value(), 'id' => $id, 'tcon' => $tcon, 'tag' => $tag, 'l' => $l, 'rgb' => $rgb, 'color' => $color, 'name' => $name, 'f' => $f, 't' => $t, 'tn' => $tn));
     $this->assertEquals($array, $action->toArray());
 }
예제 #3
0
 public function testMsgActionOp()
 {
     $values = array('delete', 'read', 'flag', 'tag', 'move', 'update', 'spam', 'trash');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\MsgActionOp::has($value));
     }
 }
예제 #4
0
 public function testMsgAction()
 {
     $action = new \Zimbra\Mail\Struct\MsgActionSelector(MsgActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn');
     $this->_api->msgAction($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:MsgActionRequest>' . '<urn1:action op="move" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" />' . '</urn1:MsgActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
예제 #5
0
 public function testMsgActionSelector()
 {
     $action = new \Zimbra\Mail\Struct\MsgActionSelector(MsgActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn');
     $this->assertTrue($action->op()->is('move'));
     $action->op(MsgActionOp::MOVE());
     $this->assertTrue($action->op()->is('move'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="move" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" />';
     $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'));
     $this->assertEquals($array, $action->toArray());
 }
예제 #6
0
 public function testMsgAction()
 {
     $action = new \Zimbra\Mail\Struct\MsgActionSelector(MsgActionOp::MOVE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn');
     $req = new \Zimbra\Mail\Request\MsgAction($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" . '<MsgActionRequest>' . '<action op="move" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" />' . '</MsgActionRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = array('MsgActionRequest' => 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')));
     $this->assertEquals($array, $req->toArray());
 }