1
0
mirror of https://github.com/danog/dns.git synced 2024-12-02 09:27:55 +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);
});
}
}