public function testConvActionApi() { $id = $this->faker->word; $tcon = $this->faker->word; $tag = mt_rand(0, 10); $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 ConvActionSelector(ConvActionOp::DELETE(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames); $this->api->convAction($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:ConvActionRequest>' . '<urn1:action op="' . ConvActionOp::DELETE() . '" id="' . $id . '" tcon="' . $tcon . '" tag="' . $tag . '" l="' . $folder . '" rgb="' . $rgb . '" color="' . $color . '" name="' . $name . '" f="' . $flags . '" t="' . $tags . '" tn="' . $tagNames . '" />' . '</urn1:ConvActionRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testConvActionSelector() { $id = $this->faker->word; $tcon = $this->faker->word; $tag = mt_rand(0, 10); $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 ConvActionSelector(ConvActionOp::DELETE(), $id, $tcon, $tag, $folder, $rgb, $color, $name, $flags, $tags, $tagNames); $this->assertInstanceOf('\\Zimbra\\Mail\\Struct\\ActionSelector', $action); $this->assertTrue($action->getOperation()->is('delete')); $action->setOperation(ConvActionOp::DELETE()); $this->assertTrue($action->getOperation()->is('delete')); $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . ConvActionOp::DELETE() . '" 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' => ConvActionOp::DELETE()->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()); }
public function testConvActionOp() { $values = array('delete', 'read', 'flag', 'priority', 'tag', 'move', 'spam', 'trash'); foreach ($values as $value) { $this->assertTrue(\Zimbra\Enum\ConvActionOp::has($value)); } }
public function testConvAction() { $action = new \Zimbra\Mail\Struct\ConvActionSelector(ConvActionOp::DELETE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn'); $this->_api->convAction($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:ConvActionRequest>' . '<urn1:action op="delete" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" />' . '</urn1:ConvActionRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testConvActionSelector() { $action = new \Zimbra\Mail\Struct\ConvActionSelector(ConvActionOp::DELETE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn'); $this->assertInstanceOf('\\Zimbra\\Mail\\Struct\\ActionSelector', $action); $this->assertTrue($action->op()->is('delete')); $action->op(ConvActionOp::DELETE()); $this->assertTrue($action->op()->is('delete')); $xml = '<?xml version="1.0"?>' . "\n" . '<action op="delete" 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' => 'delete', '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()); }
public function testConvAction() { $action = new \Zimbra\Mail\Struct\ConvActionSelector(ConvActionOp::DELETE(), 'id', 'tcon', 10, 'l', '#aabbcc', 10, 'name', 'f', 't', 'tn'); $req = new \Zimbra\Mail\Request\ConvAction($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" . '<ConvActionRequest>' . '<action op="delete" id="id" tcon="tcon" tag="10" l="l" rgb="#aabbcc" color="10" name="name" f="f" t="t" tn="tn" />' . '</ConvActionRequest>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); $array = array('ConvActionRequest' => array('_jsns' => 'urn:zimbraMail', 'action' => array('op' => 'delete', '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()); }