/**
  * @covers SysEleven\PowerDnsBundle\Validator\Constraints\RecordValidator::_validateNs
  * @covers SysEleven\PowerDnsBundle\Validator\Constraints\RecordValidator::_checkHostname
  */
 public function testValidateNs()
 {
     /**
      * @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('NS');
     $recordObj->setContent('1_');
     $recordObj->setPrio(-1);
     $validator = $this->container->get('validator');
     $errors = $validator->validate($recordObj);
     $this->assertCount(3, $errors);
 }
 public function loadFooBar_de(ObjectManager $manager)
 {
     /**
      * @type RecordWorkflow $recordWorkflow
      */
     $recordWorkflow = $this->container->get('syseleven.pdns.workflow.records');
     $domainObj = new Domains();
     $domainObj->setName('foobar.de');
     $domainObj->setType('NATIVE');
     $manager->persist($domainObj);
     $manager->flush();
     $soa = new Records();
     $soa->setName('foobar.de');
     $soa->setType('SOA');
     $soa->setContent('  1375872531 10800 604800 3600 ');
     $soa->setTtl(3600);
     $soa->setChangeDate(strtotime('now'));
     $soa->setManaged(1);
     $soa->setDomain($domainObj);
     $recordWorkflow->create($soa);
     $domainObj->addRecord($soa);
     $recordWorkflow->createHistory($soa, 'CREATE');
     $ns1 = new Records();
     $ns1->setName('foobar.de');
     $ns1->setContent('ns1.ns.de');
     $ns1->setPrio(10);
     $ns1->setTtl(3600);
     $ns1->setType('NS');
     $ns1->setDomain($domainObj);
     $recordWorkflow->create($ns1);
     $ns2 = new Records();
     $ns2->setName('foobar.de');
     $ns2->setContent('ns2.ns.de');
     $ns2->setPrio(20);
     $ns2->setTtl(3600);
     $ns2->setType('NS');
     $ns2->setDomain($domainObj);
     $recordWorkflow->create($ns2);
     $mx = new Records();
     $mx->setName('foobar.de');
     $mx->setContent('mail.foobar.de');
     $mx->setPrio(20);
     $mx->setTtl(3600);
     $mx->setType('MX');
     $mx->setDomain($domainObj);
     $recordWorkflow->create($mx);
     $www = new Records();
     $www->setName('www.foobar.de');
     $www->setType('A');
     $www->setContent('2.1.1.1');
     $www->setDomain($domainObj);
     $recordWorkflow->create($www);
     $www = new Records();
     $www->setName('www2.foobar.de');
     $www->setType('CNAME');
     $www->setContent('www.foobar.de');
     $www->setDomain($domainObj);
     $recordWorkflow->create($www);
 }