示例#1
0
 /**
  * Get DNS.
  *
  * @param string $subdomain
  *
  * @return Dns
  */
 protected function _getDns($subdomain = '')
 {
     $domain = new Domain();
     $domain->setDomain('lampcp.de');
     $dns = new Dns($domain);
     if (!empty($subdomain)) {
         $dns->setSubdomain($subdomain);
     }
     return $dns;
 }
 /**
  * Provide test domains.
  *
  * @return array
  */
 public function domainProvider()
 {
     $certRoot = new Certificate();
     $certRoot->setName('root');
     $certAlias = new Certificate();
     $certAlias->setName('alias');
     $root = new Domain();
     $root->setDomain('root.de')->setPath('/var/www/root')->setCertificate($certRoot);
     $alias = new Domain();
     $alias->setDomain('alias.de')->setPath('/var/www/alias')->setCertificate($certAlias)->setParent($root);
     return array(array($root), array($alias));
 }
示例#3
0
 /**
  * Provide test-data.
  */
 public function dataProvider()
 {
     $certificate = new Certificate();
     $domainWithoutIp = new Domain();
     $domainWithoutIp->setDomain('withoutIp.de');
     $ipaddressWithSSL = new IpAddress();
     $ipaddressWithSSL->setHasSsl(true);
     $ipaddressWithoutSSL = new IpAddress();
     $ipaddressWithoutSSL->setHasSsl(false);
     $domainWithIPs = new Domain();
     $domainWithIPs->setDomain('withIp.de')->setIpaddress(new ArrayCollection(array($ipaddressWithoutSSL, $ipaddressWithSSL)))->setCertificate($certificate);
     $subdomainWithSSL = new Subdomain($domainWithIPs);
     $subdomainWithSSL->setCertificate($certificate)->setSubdomain('withssl');
     $subdomainWithSSL2 = new Subdomain($domainWithoutIp);
     $subdomainWithSSL2->setCertificate($certificate)->setSubdomain('withssl');
     $subdomainWithoutSSL = new Subdomain($domainWithIPs);
     $subdomainWithoutSSL->setSubdomain('withoutssl');
     $subdomainWithoutSSL2 = new Subdomain($domainWithoutIp);
     $subdomainWithoutSSL2->setSubdomain('withoutssl');
     return array(array($domainWithIPs, $subdomainWithoutSSL), array($domainWithIPs, $subdomainWithSSL), array($domainWithoutIp, $subdomainWithSSL2), array($domainWithoutIp, $subdomainWithoutSSL2), array($domainWithIPs), array($domainWithoutIp));
 }
示例#4
0
 /**
  * Get new domain.
  *
  * @return Domain
  */
 protected function _getDomain()
 {
     $domain = new Domain();
     $domain->setDomain($this->_name . '.de')->setPath(sys_get_temp_dir());
     return $domain;
 }
示例#5
0
 /**
  * Test getServerAlias()
  */
 public function testGetServerAlias()
 {
     $vhost = new Vhost();
     $domain = new Domain();
     $subdomain = new Subdomain($domain);
     $domain->setDomain('lampcp.de');
     $subdomain->setSubdomain('test');
     // www.lampcp.de
     $vhost->setDomain($domain);
     $result0 = $vhost->getServerAlias();
     // *.lampcp.de
     $domain->setIsWildcard(true);
     $result1 = $vhost->getServerAlias();
     // www.test.lampcp.de
     $vhost->setSubdomain($subdomain);
     $result2 = $vhost->getServerAlias();
     // *.test.lampcp.de
     $subdomain->setIsWildcard(true);
     $result3 = $vhost->getServerAlias();
     $this->assertEquals('www.lampcp.de', array_pop($result0));
     $this->assertEquals('*.lampcp.de', array_pop($result1));
     $this->assertEquals('www.test.lampcp.de', array_pop($result2));
     $this->assertEquals('*.test.lampcp.de', array_pop($result3));
 }
示例#6
0
 /**
  * Generate LampCP Domain.
  *
  * @param Vhost $vhost
  *
  * @return Domain
  * @throws UserNotFoundException
  */
 protected function _generateLampcpDomain(Vhost $vhost)
 {
     $domain = new Domain();
     $ip = new IpAddress();
     /** @var User $user */
     $user = $this->getUserRepository()->findOneBy(array('name' => $vhost->user));
     if (!$user) {
         throw new UserNotFoundException();
     }
     $ip->setAlias('Default ip address')->setIp($vhost->ipaddress);
     $domain->setDomain($vhost->address)->setPath(realpath(__DIR__ . '/../../../../../../'))->setWebroot('htdocs/web')->setUser($user)->getIpaddress()->add($ip);
     return $domain;
 }
 /**
  * Test get / set domain.
  */
 public function testDomainGetterSetter()
 {
     $service = $this->getVhostBuilderService();
     $domain = new Domain();
     $domains = array($domain);
     $domain->setDomain('test.de');
     $service->setDomains($domains);
     $this->assertEquals($domains, $service->getDomains());
 }