Exemplo n.º 1
0
 public function testCountObjectsRequest()
 {
     $value = $this->faker->word;
     $domain = new DomainSelector(DomainBy::NAME(), $value);
     $ucservice = new UcServiceSelector(UcServiceBy::NAME(), $value);
     $req = new 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());
 }