Beispiel #1
0
 public function testAutoProvPrincipalBy()
 {
     $values = array('dn', 'name');
     foreach ($values as $value) {
         $this->assertTrue(\Zimbra\Enum\AutoProvPrincipalBy::has($value));
     }
 }
 public function testAutoProvAccountApi()
 {
     $value = $this->faker->word;
     $password = $this->faker->word;
     $domain = new DomainSelector(DomainBy::NAME(), $value);
     $principal = new PrincipalSelector(PrincipalBy::DN(), $value);
     $this->api->autoProvAccount($domain, $principal, $password);
     $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:AutoProvAccountRequest>' . '<urn1:domain by="' . DomainBy::NAME() . '">' . $value . '</urn1:domain>' . '<urn1:principal by="' . PrincipalBy::DN() . '">' . $value . '</urn1:principal>' . '<urn1:password>' . $password . '</urn1:password>' . '</urn1:AutoProvAccountRequest>' . '</env:Body>' . '</env:Envelope>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
 }
 public function testPrincipalSelector()
 {
     $value = $this->faker->word;
     $pri = new PrincipalSelector(PrincipalBy::DN(), $value);
     $this->assertSame('dn', $pri->getBy()->value());
     $this->assertSame($value, $pri->getValue());
     $pri->setBy(PrincipalBy::NAME());
     $this->assertSame('name', $pri->getBy()->value());
     $xml = '<?xml version="1.0"?>' . "\n" . '<principal by="' . PrincipalBy::NAME() . '">' . $value . '</principal>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $pri);
     $array = ['principal' => ['by' => PrincipalBy::NAME()->value(), '_content' => $value]];
     $this->assertEquals($array, $pri->toArray());
 }
Beispiel #4
0
 public function testAutoProvAccount()
 {
     $value = self::randomName();
     $password = self::randomName();
     $domain = new \Zimbra\Admin\Struct\DomainSelector(DomainBy::NAME(), $value);
     $principal = new \Zimbra\Admin\Struct\PrincipalSelector(PrincipalBy::DN(), $value);
     $req = new \Zimbra\Admin\Request\AutoProvAccount($domain, $principal, $password);
     $this->assertInstanceOf('Zimbra\\Admin\\Request\\Base', $req);
     $this->assertSame($domain, $req->getDomain());
     $this->assertSame($principal, $req->getPrincipal());
     $this->assertSame($password, $req->getPassword());
     $req->setDomain($domain)->setPrincipal($principal)->setPassword($password);
     $this->assertSame($domain, $req->getDomain());
     $this->assertSame($principal, $req->getPrincipal());
     $this->assertSame($password, $req->getPassword());
     $xml = '<?xml version="1.0"?>' . "\n" . '<AutoProvAccountRequest>' . '<domain by="' . DomainBy::NAME() . '">' . $value . '</domain>' . '<principal by="' . PrincipalBy::DN() . '">' . $value . '</principal>' . '<password>' . $password . '</password>' . '</AutoProvAccountRequest>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $req);
     $array = ['AutoProvAccountRequest' => ['_jsns' => 'urn:zimbraAdmin', 'domain' => ['by' => DomainBy::NAME()->value(), '_content' => $value], 'principal' => ['by' => PrincipalBy::DN()->value(), '_content' => $value], 'password' => $password]];
     $this->assertEquals($array, $req->toArray());
 }