1
0
mirror of https://github.com/danog/dns.git synced 2025-01-23 05:51:11 +01:00
dns/test/IntegrationTest.php
2017-01-10 23:49:38 -06:00

34 lines
856 B
PHP

<?php
namespace Amp\Dns\Test;
use AsyncInterop\Loop;
class IntegrationTest extends \PHPUnit_Framework_TestCase {
/**
* @group internet
*/
public function testResolve() {
Loop::execute(\Amp\wrap(function () {
$names = [
"google.com",
"github.com",
"stackoverflow.com",
"localhost",
"192.168.0.1",
"::1",
];
foreach ($names as $name) {
$result = (yield \Amp\Dns\resolve($name));
list($addr, $type, $ttl) = $result[0];
$inAddr = @\inet_pton($addr);
$this->assertNotFalse(
$inAddr,
"Server name $name did not resolve to a valid IP address"
);
}
}));
}
}