1
0
mirror of https://github.com/danog/dns.git synced 2024-12-02 17:38:05 +01:00
dns/test/HostLoaderTest.php

26 lines
714 B
PHP
Raw Normal View History

2017-06-23 18:07:57 +02:00
<?php
namespace Amp\Dns\Test;
use Amp\Dns\HostLoader;
use Amp\Dns\Record;
use Amp\Loop;
use Amp\PHPUnit\TestCase;
2018-01-29 02:35:57 +01:00
use DaveRandom\LibDNS\HostsFile\HostsFile;
2017-06-23 18:07:57 +02:00
class HostLoaderTest extends TestCase {
2018-01-29 02:35:57 +01:00
public function testReturnsHostsFileInstanceOnExistingFile() {
2017-06-23 18:07:57 +02:00
Loop::run(function () {
$loader = new HostLoader(__DIR__ . "/data/hosts");
2018-01-29 02:35:57 +01:00
$this->assertInstanceOf(HostsFile::class, yield $loader->loadHosts());
2017-06-23 18:07:57 +02:00
});
}
public function testReturnsEmptyErrorOnFileNotFound() {
Loop::run(function () {
$loader = new HostLoader(__DIR__ . "/data/hosts.not.found");
2018-01-29 02:35:57 +01:00
$this->assertSame(null, yield $loader->loadHosts());
2017-06-23 18:07:57 +02:00
});
}
}