1
0
mirror of https://github.com/danog/dns.git synced 2024-11-27 04:24:48 +01:00
dns/test/UnixConfigLoaderTest.php

32 lines
859 B
PHP
Raw Normal View History

<?php
namespace Amp\Dns\Test;
use Amp\Dns\Config;
use Amp\Dns\ConfigException;
use Amp\Dns\UnixConfigLoader;
2017-06-17 10:49:54 +02:00
use Amp\PHPUnit\TestCase;
use function Amp\Promise\wait;
class UnixConfigLoaderTest extends TestCase {
public function test() {
$loader = new UnixConfigLoader(__DIR__ . "/data/resolv.conf");
/** @var Config $result */
$result = wait($loader->loadConfig());
$this->assertSame([
"127.0.0.1:53",
"[2001:4860:4860::8888]:53",
], $result->getNameservers());
$this->assertSame(5000, $result->getTimeout());
$this->assertSame(3, $result->getAttempts());
}
public function testNoDefaultsOnConfNotFound() {
$this->expectException(ConfigException::class);
wait((new UnixConfigLoader(__DIR__ . "/data/non-existent.conf"))->loadConfig());
}
2017-06-17 10:49:54 +02:00
}