Esempio n. 1
0
 /**
  * Get service.
  *
  * @return VhostBuilderService
  */
 public function serviceProvider()
 {
     $service = $this->getVhostBuilderService();
     $certificate = new Certificate();
     $user = new User();
     $defaultIpSsl = new IpAddress();
     $defaultIp = new IpAddress();
     $certificate->setName('normal')->setCertificateFile('asd')->setCertificateKeyFile('dodooodood');
     $user->setName('jeff')->setGroupname('jeff')->setUid(1000)->setGid(1000);
     $defaultIp->setAlias('default, no ssl')->setHasSsl(false)->setIp('127.0.0.1')->setPort(80);
     $defaultIpSsl->setAlias('default, ssl')->setHasSsl(true)->setIp('127.0.0.1')->setPort(443);
     $domain1 = new Domain();
     $domain2 = new Domain();
     $domain3 = new Domain();
     $domain1->setDomain('lampcp1.de')->setPath('/var/www/lampcp1.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate);
     $domain2->setDomain('lampcp2.de')->setPath('/var/www/lampcp2.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs');
     $domain3->setDomain('lampcp3.de')->setPath('/var/www/lampcp3.de')->setParsePhp(false)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate);
     $domain1->getIpaddress()->add($defaultIp);
     $domain2->getIpaddress()->add($defaultIpSsl);
     $domain2->getIpaddress()->add($defaultIp);
     $domain3->getIpaddress()->add($defaultIpSsl);
     $subdomain1 = new Subdomain($domain1);
     $subdomain2 = new Subdomain($domain2);
     $subdomain1->setSubdomain('nopaste');
     $subdomain2->setSubdomain('wiki');
     $domain1->getSubdomain()->add($subdomain1);
     $domain2->getSubdomain()->add($subdomain2);
     $service->setDomains(array($domain1, $domain2, $domain3));
     return array(array($service));
 }
Esempio n. 2
0
 /**
  * CustomConfig
  *
  * @return string
  */
 public function getCustomConfig()
 {
     if ($this->isSubDomain()) {
         $custom = $this->subdomain->getCustomconfig();
     } else {
         $custom = $this->domain->getCustomconfig();
     }
     return $custom;
 }
Esempio n. 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));
 }
Esempio n. 4
0
 /**
  * Get parent subdomain and set some properties
  * from parent domain.
  *
  * @param Subdomain $subdomain
  *
  * @return Subdomain
  */
 public static function transformAliasSubdomain(Subdomain $subdomain)
 {
     if ($subdomain->getParent() !== null) {
         $domain = self::transformAliasDomain($subdomain->getDomain());
         $parent = clone $subdomain->getParent();
         $parent->setDomain($domain)->setSubdomain($subdomain->getSubdomain())->setCertificate($subdomain->getCertificate());
         return $parent;
     }
     return $subdomain;
 }
 /**
  * Provide test subdomains.
  */
 public function subdomainProvider()
 {
     $domains = array();
     $certRoot = new Certificate();
     $certAlias = new Certificate();
     $certRoot->setName('root');
     $certAlias->setName('alias');
     /*
      * Collect test domains from provider.
      */
     foreach ($this->domainProvider() as $arrDomain) {
         $domains[] = array_pop($arrDomain);
     }
     $alias = new Subdomain(array_pop($domains));
     $root = new Subdomain(array_pop($domains));
     $alias->setSubdomain('alias')->setPath('/var/www/alias/alias')->setCertificate($certAlias)->setParent($root);
     $root->setSubdomain('root')->setPath('/var/www/root/root')->setCertificate($certRoot);
     return array(array($alias), array($root));
 }
Esempio n. 6
0
 /**
  * Test getForceSSL().
  */
 public function testGetForceSSL()
 {
     $domain = new Domain();
     $vhost = new Vhost();
     $certificate = new Certificate();
     $subdomain = new Subdomain($domain);
     $ip = new IpAddress();
     $certificate->setName('test')->setCertificateFile('asdasdasdds');
     $domain->setCertificate($certificate)->setForceSsl(true);
     $subdomain->setCertificate($certificate)->setForceSsl(true);
     $vhost->setDomain($domain);
     $this->assertTrue($vhost->getForceSSL());
     $vhost->setSubdomain($subdomain);
     $this->assertTrue($vhost->getForceSSL());
     $ip->setHasSsl(true);
     $vhost->setIpaddress($ip);
     $this->assertFalse($vhost->getForceSSL());
 }