Пример #1
0
 public function testDeleteXMPPComponentApi()
 {
     $value = $this->faker->word;
     $xmpp = new XmppComponentSelector(XmppBy::NAME(), $value);
     $this->api->deleteXMPPComponent($xmpp);
     $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:zimbraAdmin">' . '<env:Body>' . '<urn1:DeleteXMPPComponentRequest>' . '<urn1:xmppcomponent by="' . XmppBy::NAME() . '">' . $value . '</urn1:xmppcomponent>' . '</urn1:DeleteXMPPComponentRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testXmppComponentSelector()
 {
     $value = $this->faker->word;
     $xmpp = new XmppComponentSelector(XmppBy::ID(), $value);
     $this->assertTrue($xmpp->getBy()->is('id'));
     $this->assertSame($value, $xmpp->getValue());
     $xmpp->setBy(XmppBy::NAME());
     $this->assertTrue($xmpp->getBy()->is('name'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<xmppcomponent by="' . XmppBy::NAME() . '">' . $value . '</xmppcomponent>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $xmpp);
     $array = ['xmppcomponent' => ['by' => XmppBy::NAME()->value(), '_content' => $value]];
     $this->assertEquals($array, $xmpp->toArray());
 }
Пример #3
0
 public function testXmppComponentBy()
 {
     $values = array('id', 'name', 'serviceHostname');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\XmppComponentBy::has($value));
     }
 }
Пример #4
0
 public function testGetXMPPComponent()
 {
     $value = self::randomName();
     $attrs = self::randomName();
     $xmpp = new \Zimbra\Admin\Struct\XmppComponentSelector(XmppBy::NAME(), $value);
     $this->_api->getXMPPComponent($xmpp, [$attrs]);
     $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:zimbraAdmin">' . '<env:Body>' . '<urn1:GetXMPPComponentRequest attrs="' . $attrs . '">' . '<urn1:xmppcomponent by="' . XmppBy::NAME() . '">' . $value . '</urn1:xmppcomponent>' . '</urn1:GetXMPPComponentRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Пример #5
0
 public function testGetXMPPComponent()
 {
     $value = self::randomName();
     $attrs = self::randomName();
     $xmpp = new \Zimbra\Admin\Struct\XmppComponentSelector(XmppBy::NAME(), $value);
     $req = new \Zimbra\Admin\Request\GetXMPPComponent($xmpp, [$attrs]);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertSame($xmpp, $req->getComponent());
     $req->setComponent($xmpp);
     $this->assertSame($xmpp, $req->getComponent());
     $xml = '<?xml version="1.0"?>' . "\n" . '<GetXMPPComponentRequest attrs="' . $attrs . '">' . '<xmppcomponent by="' . XmppBy::NAME() . '">' . $value . '</xmppcomponent>' . '</GetXMPPComponentRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['GetXMPPComponentRequest' => ['_jsns' => 'urn:zimbraAdmin', 'attrs' => $attrs, 'xmppcomponent' => ['by' => XmppBy::NAME()->value(), '_content' => $value]]];
     $this->assertEquals($array, $req->toArray());
 }