public function testAction() { $values = array('edit', 'revoke', 'expire', 'start', 'status', 'stop'); foreach ($values as $value) { $this->assertTrue(\Zimbra\Enum\Action::has($value)); } }
public function testSendShareNotificationApi() { $id = $this->faker->uuid; $address = $this->faker->word; $personal = $this->faker->word; $notes = $this->faker->word; $item = new Id($id); $e = new EmailAddrInfo($address, AddressType::FROM(), $personal); $this->api->sendShareNotification($item, [$e], $notes, Action::EDIT()); $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:SendShareNotificationRequest action="' . Action::EDIT() . '">' . '<urn1:item id="' . $id . '" />' . '<urn1:notes>' . $notes . '</urn1:notes>' . '<urn1:e a="' . $address . '" t="' . AddressType::FROM() . '" p="' . $personal . '" />' . '</urn1:SendShareNotificationRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testSendShareNotification() { $item = new \Zimbra\Struct\Id('id'); $e = new \Zimbra\Mail\Struct\EmailAddrInfo('a', 't', 'p'); $this->_api->sendShareNotification($item, array($e), 'notes', Action::EDIT()); $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:SendShareNotificationRequest action="edit">' . '<urn1:item id="id" />' . '<urn1:notes>notes</urn1:notes>' . '<urn1:e a="a" t="t" p="p" />' . '</urn1:SendShareNotificationRequest>' . '</env:Body>' . '</env:Envelope>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); }
public function testSendShareNotification() { $item = new \Zimbra\Struct\Id('id'); $e = new \Zimbra\Mail\Struct\EmailAddrInfo('a', 't', 'p'); $req = new \Zimbra\Mail\Request\SendShareNotification($item, array($e), 'notes', Action::EDIT()); $this->assertInstanceOf('Zimbra\\Mail\\Request\\Base', $req); $this->assertSame($item, $req->item()); $this->assertSame(array($e), $req->e()->all()); $this->assertSame('notes', $req->notes()); $this->assertTrue($req->action()->is('edit')); $req->item($item)->addE($e)->notes('notes')->action(Action::EDIT()); $this->assertSame($item, $req->item()); $this->assertSame(array($e, $e), $req->e()->all()); $this->assertSame('notes', $req->notes()); $this->assertTrue($req->action()->is('edit')); $req->e()->remove(1); $xml = '<?xml version="1.0"?>' . "\n" . '<SendShareNotificationRequest action="edit">' . '<item id="id" />' . '<notes>notes</notes>' . '<e a="a" t="t" p="p" />' . '</SendShareNotificationRequest>'; $this->assertXmlStringEqualsXmlString($xml, (string) $req); $array = array('SendShareNotificationRequest' => array('_jsns' => 'urn:zimbraMail', 'notes' => 'notes', 'action' => 'edit', 'item' => array('id' => 'id'), 'e' => array(array('a' => 'a', 't' => 't', 'p' => 'p')))); $this->assertEquals($array, $req->toArray()); }