예제 #1
0
 public function testCountObjectsApi()
 {
     $value = $this->faker->word;
     $domain = new DomainSelector(DomainBy::NAME(), $value);
     $ucservice = new UcServiceSelector(UcServiceBy::NAME(), $value);
     $this->api->countObjects(ObjType::ACCOUNT(), $domain, $ucservice);
     $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:CountObjectsRequest type="account">' . '<urn1:domain by="' . DomainBy::NAME() . '">' . $value . '</urn1:domain>' . '<urn1:ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</urn1:ucservice>' . '</urn1:CountObjectsRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
예제 #2
0
 public function testGetUCServiceApi()
 {
     $value = $this->faker->word;
     $attrs = $this->faker->word;
     $ucservice = new UcServiceSelector(UcServiceBy::NAME(), $value);
     $this->api->getUCService($ucservice, [$attrs]);
     $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:GetUCServiceRequest attrs="' . $attrs . '">' . '<urn1:ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</urn1:ucservice>' . '</urn1:GetUCServiceRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
예제 #3
0
 public function testUcServiceSelector()
 {
     $value = $this->faker->word;
     $ucs = new UcServiceSelector(UcServiceBy::ID(), $value);
     $this->assertSame('id', $ucs->getBy()->value());
     $ucs->setBy(UcServiceBy::NAME());
     $this->assertSame('name', $ucs->getBy()->value());
     $xml = '<?xml version="1.0"?>' . "\n" . '<ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</ucservice>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $ucs);
     $array = ['ucservice' => ['by' => UcServiceBy::NAME()->value(), '_content' => $value]];
     $this->assertEquals($array, $ucs->toArray());
 }
 public function testUpdatePresenceSessionIdApi()
 {
     $key = $this->faker->word;
     $value = $this->faker->word;
     $username = $this->faker->word;
     $password = $this->faker->word;
     $attr = new KeyValuePair($key, $value);
     $ucservice = new UcServiceSelector(UcServiceBy::NAME(), $value);
     $this->api->updatePresenceSessionId($ucservice, $username, $password, [$attr]);
     $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:UpdatePresenceSessionIdRequest>' . '<urn1:ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</urn1:ucservice>' . '<urn1:username>' . $username . '</urn1:username>' . '<urn1:password>' . $password . '</urn1:password>' . '<urn1:a n="' . $key . '">' . $value . '</urn1:a>' . '</urn1:UpdatePresenceSessionIdRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
예제 #5
0
 public function testUcServiceBy()
 {
     $values = array('id', 'name');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\UcServiceBy::has($value));
     }
 }
예제 #6
0
 public function testUpdatePresenceSessionId()
 {
     $key = self::randomName();
     $value = self::randomName();
     $username = self::randomName();
     $password = self::randomName();
     $attr = new \Zimbra\Struct\KeyValuePair($key, $value);
     $ucservice = new \Zimbra\Admin\Struct\UcServiceSelector(UcServiceBy::NAME(), $value);
     $req = new \Zimbra\Admin\Request\UpdatePresenceSessionId($ucservice, $username, $password, [$attr]);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\BaseAttr', $req);
     $this->assertSame($ucservice, $req->getUcService());
     $this->assertSame($username, $req->getUserName());
     $this->assertSame($password, $req->getPassword());
     $req->setUcService($ucservice)->setUserName($username)->setPassword($password);
     $this->assertSame($ucservice, $req->getUcService());
     $this->assertSame($username, $req->getUserName());
     $this->assertSame($password, $req->getPassword());
     $xml = '<?xml version="1.0"?>' . "\n" . '<UpdatePresenceSessionIdRequest>' . '<ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</ucservice>' . '<username>' . $username . '</username>' . '<password>' . $password . '</password>' . '<a n="' . $key . '">' . $value . '</a>' . '</UpdatePresenceSessionIdRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['UpdatePresenceSessionIdRequest' => ['_jsns' => 'urn:zimbraAdmin', 'ucservice' => ['by' => UcServiceBy::NAME()->value(), '_content' => $value], 'username' => $username, 'password' => $password, 'a' => [['n' => $key, '_content' => $value]]]];
     $this->assertEquals($array, $req->toArray());
 }