1
0
mirror of https://github.com/danog/dns.git synced 2024-11-26 20:14:51 +01:00
dns/test/BasicResolverTest.php

33 lines
920 B
PHP
Raw Normal View History

<?php
namespace Amp\Dns\Test;
use Amp\Dns\BasicResolver;
use Amp\Dns\Record;
use Amp\Dns\ResolutionException;
use Amp\Loop;
use Amp\PHPUnit\TestCase;
class BasicResolverTest extends TestCase {
public function testResolveSecondParameterAcceptedValues() {
Loop::run(function () {
$this->expectException(\Error::class);
(new BasicResolver)->resolve("abc.de", Record::TXT);
});
}
public function testIpAsArgumentWithIPv4Restriction() {
Loop::run(function () {
$this->expectException(ResolutionException::class);
yield (new BasicResolver)->resolve("::1", Record::A);
});
}
public function testIpAsArgumentWithIPv6Restriction() {
Loop::run(function () {
$this->expectException(ResolutionException::class);
yield (new BasicResolver)->resolve("127.0.0.1", Record::AAAA);
});
}
}