Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function parse($zoneName, $zone)
 {
     $this->zone->setZoneName($zoneName);
     foreach (Interpreter::expand($zone) as $line) {
         /** @var Line $line */
         $this->zone->addResourceRecord($this->lineToRr($line));
     }
     return $zone;
 }
    public function testExpand()
    {
        $test_data = <<<TXT
example.com. IN SOA example.com. (
     postmaster.example.com. ; mname
     2013011601              ; the serial number
     10800                   ; Refresh in seconds
     3600                    ; Retry in seconds
     604800                  ; Expire in seconds
     38400 )                 ; Minimum TTL

www IN CNAME example.com ; This is a comment that needs to be stripped
@   A 1800     255.255.255.255; Comments
TXT;
        $expectation = array(array('data' => 'example.com. IN SOA example.com. postmaster.example.com. 2013011601 10800 3600 604800 38400', 'comment' => 'mname the serial number Refresh in seconds Retry in seconds Expire in seconds Minimum TTL'), array('data' => 'www IN CNAME example.com', 'comment' => 'This is a comment that needs to be stripped'), array('data' => '@ A 1800 255.255.255.255', 'comment' => 'Comments'));
        $lines = Interpreter::expand($test_data);
        $this->assertEquals($expectation, $lines);
    }