/**
  * Start
  *
  * @author Koen Blokland Visser
  * @author Richard Oosterhof
  */
 public function setUp()
 {
     $DNSCollection = new DNSCollection();
     $DNSCollection->setARecords('192.168.1.1')->setAAAARecords('super.long.aaaa.record')->setMXRecords(['mail.test', 10])->setTXTRecords('long.txt.record')->setNSRecords('NS1.example.com');
     $this->DNSChecker = new DNSChecker();
     $this->DNSChecker->setDNSCollection($DNSCollection);
     parent::setUp();
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function expect($type, $rule, $key, array $expected)
 {
     if ($type === self::ARecords) {
         $this->check($type, $rule, $key, $expected, $this->DNSCollection->getARecords());
     } else {
         if ($type === self::AAAARecords) {
             $this->check($type, $rule, $key, $expected, $this->DNSCollection->getAAAARecords());
         } else {
             if ($type === self::MXRecords) {
                 $this->check($type, $rule, $key, $expected, $this->DNSCollection->getMXRecords());
             } else {
                 if ($type === self::TXTRecords) {
                     $this->check($type, $rule, $key, $expected, $this->DNSCollection->getTXTRecords());
                 } else {
                     if ($type === self::NSRecords) {
                         $this->check($type, $rule, $key, $expected, $this->DNSCollection->getNSRecords());
                     }
                 }
             }
         }
     }
     return $this;
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function feed($domainName)
 {
     $DNSCollection = new DNSCollection();
     $records = dns_get_record($domainName, DNS_ALL);
     foreach ($records as $record) {
         if (isset($record['type']) === false) {
             continue;
         }
         if ($record['type'] === 'A') {
             $DNSCollection->setARecords($record['ip']);
         } elseif ($record['type'] === 'AAAA') {
             $DNSCollection->setAAAARecords($record['ipv6']);
         } elseif ($record['type'] === 'MX') {
             $DNSCollection->setMXRecords([$record['target'], $record['pri']]);
         } elseif ($record['type'] === 'TXT') {
             $DNSCollection->setTXTRecords($record['txt']);
         } elseif ($record['type'] === 'NS') {
             $DNSCollection->setNSRecords($record['target']);
         }
     }
     return $DNSCollection;
 }
 /**
  * Test the txt record
  *
  * @author Koen Blokland Visser
  * @author Richard Oosterhof
  */
 public function testTXTRecordTest()
 {
     $this->DNSCollection->setTXTRecords('txt1');
     $this->DNSCollection->setTXTRecords('txt2');
     $this->assertSame(['txt1', 'txt2'], $this->DNSCollection->getTXTRecords());
 }