Example #1
0
 public function testDoNotDestroy()
 {
     $tmpFile = new TempFile(static::PREFIX);
     $tmpFile->write($this->twoCities);
     $path = $tmpFile->getPath();
     $tmpFile->doNotDestroy();
     $tmpFile->__destruct();
     $this->assertTrue(file_exists($path));
 }
Example #2
0
 /**
  * Tests a zone file using Bind's Check Zone feature. If CHECKZONE_PATH environment variable has been set.
  *
  * @param ZoneInterface        $zone
  * @param ZoneBuilderInterface $builder
  */
 protected function bindTest(ZoneInterface $zone, ZoneBuilderInterface $builder)
 {
     if (null === ($check_zone_path = $this->getEnvVariable(self::PHP_ENV_CHECKZONE_PATH))) {
         $this->markTestSkipped('Bind checkzone path is not defined.');
         return;
     }
     if (!`which {$check_zone_path}`) {
         $this->markTestSkipped(sprintf('The checkzone path specified "%s" could not be found.', $check_zone_path));
         return;
     }
     $zoneFile = $builder->build($zone);
     $tmpFile = new TempFile('badcow_dns_test_');
     $tmpFile->write($zoneFile);
     $this->assertTrue(Validator::validateZoneFile($zone->getName(), $tmpFile->getPath(), $check_zone_path));
 }