Пример #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 testCountObjectsType()
 {
     $values = array('userAccount', 'account', 'alias', 'dl', 'domain', 'cos', 'server', 'calresource', 'accountOnUCService', 'cosOnUCService', 'domainOnUCService', 'internalUserAccount', 'internalArchivingAccount');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\CountObjectsType::has($value));
     }
 }
Пример #3
0
 public function testCountObjects()
 {
     $value = self::randomName();
     $domain = new \Zimbra\Admin\Struct\DomainSelector(DomainBy::NAME(), $value);
     $ucservice = new \Zimbra\Admin\Struct\UcServiceSelector(UcServiceBy::NAME(), $value);
     $req = new \Zimbra\Admin\Request\CountObjects(ObjType::USER_ACCOUNT(), $domain, $ucservice);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertSame('userAccount', $req->getType()->value());
     $this->assertSame($domain, $req->getDomain());
     $this->assertSame($ucservice, $req->getUcService());
     $req->setType(ObjType::ACCOUNT())->setDomain($domain)->setUcService($ucservice);
     $this->assertSame('account', $req->getType()->value());
     $this->assertSame($domain, $req->getDomain());
     $this->assertSame($ucservice, $req->getUcService());
     $xml = '<?xml version="1.0"?>' . "\n" . '<CountObjectsRequest type="' . ObjType::ACCOUNT() . '">' . '<domain by="' . DomainBy::NAME() . '">' . $value . '</domain>' . '<ucservice by="' . UcServiceBy::NAME() . '">' . $value . '</ucservice>' . '</CountObjectsRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['CountObjectsRequest' => ['_jsns' => 'urn:zimbraAdmin', 'type' => ObjType::ACCOUNT()->value(), 'domain' => ['by' => DomainBy::NAME()->value(), '_content' => $value], 'ucservice' => ['by' => UcServiceBy::NAME()->value(), '_content' => $value]]];
     $this->assertEquals($array, $req->toArray());
 }