Exemplo n.º 1
0
    function doTests()
    {
        // prepare
        $zone_tpl = '; !Automatically generated - do not edit!
						; Zone file for {name}
						$TTL {ttl}
						@      IN      SOA     {origin} {person} (
						       {serial}    ; serial, todays date+todays
						       {refresh}        ; refresh, seconds
						       {retry}        ; retry, seconds
						       {expire}        ; expire, seconds
						       {minimum} )    ; minimum, seconds
						
						; Records
						{records}';
        define("CF_DNSZONETPL", $zone_tpl);
        $Zone = new DNSZone();
        //
        // Generation
        //
        $SOA = array("name" => "domain-dns.com", "serial" => "2005052700", "origin" => "ns.hostdad.com.", "person" => "ak.webta.net.", "ttl" => 14400, "refresh" => 14400, "retry" => 7200, "expire" => 3600000, "minimum" => 86400);
        if ($Zone->SetSOAValue($SOA)) {
            $params = array("*", "127.0.0.7");
            $Zone->AddRecord("A", $params, $rec["ttl"]);
        }
        $Zone->Generate();
        $template = 'zone "{zone}" {
								   type master;
								   file "{db_filename}";
								};';
        $this->BIND->SetZoneTemplate($template);
        $retval = $this->BIND->ListZones();
        $this->BIND->ConfCleanup();
        $retval = $this->BIND->SaveConf();
        $this->assertTrue($retval, "named.conf saved ok");
        $this->assertNoUnwantedPattern("/\\n\\n\\n/m", "named.conf does not contain unneeded stuff");
        $res = $this->BIND->SaveZone($Zone->Name, $Zone->Content);
        $this->assertTrue($res, "Zone successfully saved");
        $res = $this->BIND->DeleteZone($Zone->Name);
        $this->assertTrue($res, "Zone successfully deleted");
        $retval = $this->BIND->IsZoneExists($Zone->Name);
        $this->assertFalse($retval, "Zone file does not exists");
    }