/**
  * @return Domains
  */
 public function testCreate()
 {
     $domainObj = new Domains();
     $domainObj->setName('test.de');
     $domainObj->setType('NATIVE');
     $domainObj = $this->workflow->create($domainObj);
     $this->assertNotEmpty($domainObj->getId());
     $soa = $domainObj->getSoa();
     $this->assertInstanceOf('\\SysEleven\\PowerDnsBundle\\Entity\\Records', $soa);
     $this->assertEquals('test.de', $soa->getName());
     return $domainObj->getId();
 }
 /**
  * @covers SysEleven\PowerDnsBundle\Validator\Constraints\RecordValidator::_validatePtr
  * @covers SysEleven\PowerDnsBundle\Validator\Constraints\RecordValidator::_checkHostname
  * @covers SysEleven\PowerDnsBundle\Validator\Constraints\RecordValidator::_checkPtr
  */
 public function testValidatePtr()
 {
     /**
      * @type DomainWorkflow $workflow
      */
     $workflow = $this->container->get('syseleven.pdns.workflow.domains');
     /**
      * @type Domains $domainObj
      */
     $domainObj = $workflow->getRepository()->findOneBy(array());
     $recordObj = new Records();
     $recordObj->setDomain($domainObj);
     $recordObj->setName('bogus___.');
     $recordObj->setType('PTR');
     $recordObj->setContent('1_');
     $recordObj->setPrio(-1);
     $validator = $this->container->get('validator');
     $errors = $validator->validate($recordObj);
     $this->assertCount(3, $errors);
     $domainObj = new Domains();
     $domainObj->setName('1.1.1.in-addr.arpa');
     $domainObj->setType('NATIVE');
     $domainObj = $workflow->create($domainObj);
     $recordObj = new Records();
     $recordObj->setName('1.1.1.1.in-addr.arpa');
     $recordObj->setType('PTR');
     $recordObj->setContent('www.example.com');
     $recordObj->setDomain($domainObj);
     $errors = $validator->validate($recordObj);
     $this->assertCount(0, $errors);
 }
Пример #3
0
 public function loadMaster_de(ObjectManager $manager)
 {
     $domainObj = new Domains();
     $domainObj->setName('master.de');
     $domainObj->setType('MASTER');
     $manager->persist($domainObj);
     $manager->flush();
 }