Example #1
0
    /**
     * Test create().
     */
    public function testCreate()
    {
        $expect = <<<EOT
zone "test.name" IN {
    type master;
    file "test.file";
};
EOT;
        $result = ZoneDefinition::create('test.name', 'test.file');
        $this->assertEquals($expect, $result);
    }
Example #2
0
 /**
  * Build configuration
  */
 public function build()
 {
     $this->_checkRequirements();
     $dns = $this->_getDnsEntities();
     $zoneDefinition = array();
     foreach ($dns as $entity) {
         $pathZoneDb = sprintf('%s/%s.%s', $this->_getZoneDirectory(), $entity->getOrigin(), 'db');
         $zoneDefinition[] = ZoneDefinition::create($entity->getOrigin(), $pathZoneDb);
         $transformer = new ZonefileTransformer($entity->getZonecollection());
         file_put_contents($pathZoneDb, $transformer->transform());
     }
     file_put_contents($this->_getZoneDefinitionPath(), join(PHP_EOL . PHP_EOL, $zoneDefinition));
 }