示例#1
0
 public function testVoiceMsgActionApi()
 {
     $id = $this->faker->word;
     $name = $this->faker->word;
     $accountNumber = $this->faker->word;
     $phone = $this->faker->word;
     $folderId = $this->faker->word;
     $action = new VoiceMsgActionSpec(VoiceMsgActionOp::MOVE(), $phone, $id, $folderId);
     $storeprincipal = new StorePrincipalSpec($id, $name, $accountNumber);
     $this->api->voiceMsgAction($action, $storeprincipal);
     $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:zimbraVoice">' . '<env:Body>' . '<urn1:VoiceMsgActionRequest>' . '<urn1:storeprincipal id="' . $id . '" name="' . $name . '" accountNumber="' . $accountNumber . '" />' . '<urn1:action op="' . VoiceMsgActionOp::MOVE() . '" phone="' . $phone . '" id="' . $id . '" l="' . $folderId . '" />' . '</urn1:VoiceMsgActionRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testVoiceMsgActionSpec()
 {
     $phone = $this->faker->word;
     $id = $this->faker->word;
     $folderId = $this->faker->word;
     $action = new VoiceMsgActionSpec(VoiceMsgActionOp::MOVE(), $phone, $id, $folderId);
     $this->assertTrue($action->getOperation()->is('move'));
     $this->assertSame($phone, $action->getPhone());
     $this->assertSame($id, $action->getId());
     $this->assertSame($folderId, $action->getFolderId());
     $action->setOperation(VoiceMsgActionOp::MOVE())->setPhone($phone)->setId($id)->setFolderId($folderId);
     $this->assertTrue($action->getOperation()->is('move'));
     $this->assertSame($phone, $action->getPhone());
     $this->assertSame($id, $action->getId());
     $this->assertSame($folderId, $action->getFolderId());
     $xml = '<?xml version="1.0"?>' . "\n" . '<action op="' . VoiceMsgActionOp::MOVE() . '" phone="' . $phone . '" id="' . $id . '" l="' . $folderId . '" />';
     $this->assertXmlStringEqualsXmlString($xml, (string) $action);
     $array = ['action' => ['op' => VoiceMsgActionOp::MOVE()->value(), 'phone' => $phone, 'id' => $id, 'l' => $folderId]];
     $this->assertEquals($array, $action->toArray());
 }
示例#3
0
 public function testVoiceMsgActionOp()
 {
     $values = array('move', 'read', '!read', 'empty', 'delete');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\VoiceMsgActionOp::has($value));
     }
 }
示例#4
0
 public function testVoiceMsgAction()
 {
     $id = self::randomName();
     $name = self::randomName();
     $accountNumber = self::randomName();
     $phone = self::randomName();
     $folderId = self::randomName();
     $action = new \Zimbra\Voice\Struct\VoiceMsgActionSpec(VoiceMsgActionOp::MOVE(), $phone, $id, $folderId);
     $storeprincipal = new \Zimbra\Voice\Struct\StorePrincipalSpec($id, $name, $accountNumber);
     $req = new \Zimbra\Voice\Request\VoiceMsgAction($action, $storeprincipal);
     $this->assertInstanceOf('Zimbra\\Voice\\Request\\Base', $req);
     $this->assertSame($storeprincipal, $req->getStorePrincipal());
     $this->assertSame($action, $req->getAction());
     $req->setStorePrincipal($storeprincipal)->setAction($action);
     $this->assertSame($storeprincipal, $req->getStorePrincipal());
     $this->assertSame($action, $req->getAction());
     $xml = '<?xml version="1.0"?>' . "\n" . '<VoiceMsgActionRequest>' . '<storeprincipal id="' . $id . '" name="' . $name . '" accountNumber="' . $accountNumber . '" />' . '<action op="' . VoiceMsgActionOp::MOVE() . '" phone="' . $phone . '" id="' . $id . '" l="' . $folderId . '" />' . '</VoiceMsgActionRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['VoiceMsgActionRequest' => ['_jsns' => 'urn:zimbraVoice', 'storeprincipal' => ['id' => $id, 'name' => $name, 'accountNumber' => $accountNumber], 'action' => ['op' => VoiceMsgActionOp::MOVE()->value(), 'phone' => $phone, 'id' => $id, 'l' => $folderId]]];
     $this->assertEquals($array, $req->toArray());
 }