public function testGetSystemRetentionPolicyApi()
 {
     $value = $this->faker->word;
     $cos = new CosSelector(CosBy::NAME(), $value);
     $this->api->getSystemRetentionPolicy($cos);
     $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:GetSystemRetentionPolicyRequest>' . '<urn1:cos by="' . CosBy::NAME() . '">' . $value . '</urn1:cos>' . '</urn1:GetSystemRetentionPolicyRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testClearTwoFactorAuthDataApi()
 {
     $value = $this->faker->word;
     $cos = new CosSelector(CosBy::NAME(), $value);
     $account = new AccountSelector(AccountBy::NAME(), $value);
     $this->api->clearTwoFactorAuthData($cos, $account);
     $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:ClearTwoFactorAuthDataRequest>' . '<urn1:cos by="' . CosBy::NAME() . '">' . $value . '</urn1:cos>' . '<urn1:account by="' . AccountBy::NAME() . '">' . $value . '</urn1:account>' . '</urn1:ClearTwoFactorAuthDataRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemple #3
0
 public function testCosSelector()
 {
     $value = $this->faker->word;
     $cos = new CosSelector(CosBy::ID(), $value);
     $this->assertTrue($cos->getBy()->is('id'));
     $this->assertSame($value, $cos->getValue());
     $cos->setBy(CosBy::NAME());
     $this->assertTrue($cos->getBy()->is('name'));
     $xml = '<?xml version="1.0"?>' . "\n" . '<cos by="' . CosBy::NAME() . '">' . $value . '</cos>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $cos);
     $array = ['cos' => ['by' => CosBy::NAME()->value(), '_content' => $value]];
     $this->assertEquals($array, $cos->toArray());
 }
 public function testGetCreateObjectAttrsApi()
 {
     $value = $this->faker->word;
     $type = $this->faker->word;
     $target = new TargetWithType($type, $value);
     $cos = new CosSelector(CosBy::NAME(), $value);
     $domain = new DomainSelector(DomainBy::NAME(), $value);
     $this->api->getCreateObjectAttrs($target, $domain, $cos);
     $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:GetCreateObjectAttrsRequest>' . '<urn1:target type="' . $type . '">' . $value . '</urn1:target>' . '<urn1:domain by="' . DomainBy::NAME() . '">' . $value . '</urn1:domain>' . '<urn1:cos by="' . CosBy::NAME() . '">' . $value . '</urn1:cos>' . '</urn1:GetCreateObjectAttrsRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testDeleteSystemRetentionPolicyApi()
 {
     $value = $this->faker->word;
     $id = $this->faker->word;
     $name = $this->faker->word;
     $lifetime = $this->faker->word;
     $cos = new CosSelector(CosBy::NAME(), $value);
     $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $this->api->deleteSystemRetentionPolicy($policy, $cos);
     $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" xmlns:urn2="urn:zimbraMail">' . '<env:Body>' . '<urn1:DeleteSystemRetentionPolicyRequest>' . '<urn2:policy type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '<urn1:cos by="' . CosBy::NAME() . '">' . $value . '</urn1:cos>' . '</urn1:DeleteSystemRetentionPolicyRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
Exemple #6
0
 public function testCosBy()
 {
     $values = array('id', 'name');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\CosBy::has($value));
     }
 }
 public function testModifySystemRetentionPolicy()
 {
     $value = self::randomName();
     $id = self::randomName();
     $name = self::randomName();
     $lifetime = self::randomName();
     $cos = new \Zimbra\Admin\Struct\CosSelector(CosBy::NAME(), $value);
     $policy = new \Zimbra\Admin\Struct\Policy(Type::SYSTEM(), $id, $name, $lifetime);
     $req = new \Zimbra\Admin\Request\ModifySystemRetentionPolicy($policy, $cos);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertSame($policy, $req->getPolicy());
     $this->assertSame($cos, $req->getCos());
     $req->setPolicy($policy)->setCos($cos);
     $this->assertSame($policy, $req->getPolicy());
     $this->assertSame($cos, $req->getCos());
     $xml = '<?xml version="1.0"?>' . "\n" . '<ModifySystemRetentionPolicyRequest>' . '<policy xmlns="urn:zimbraMail" type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />' . '<cos by="' . CosBy::NAME() . '">' . $value . '</cos>' . '</ModifySystemRetentionPolicyRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['ModifySystemRetentionPolicyRequest' => ['_jsns' => 'urn:zimbraAdmin', 'policy' => ['_jsns' => 'urn:zimbraMail', 'type' => Type::SYSTEM()->value(), 'id' => $id, 'name' => $name, 'lifetime' => $lifetime], 'cos' => ['by' => CosBy::NAME()->value(), '_content' => $value]]];
     $this->assertEquals($array, $req->toArray());
 }