1
0
mirror of https://github.com/danog/dns.git synced 2025-01-22 21:41:11 +01:00
dns/test/IntegrationTest.php
Bob Weinand ebb5fb510c Switch to a new API to enable getting not only the first entry and not only A/AAAA records
This now can do queries to dns servers and you'll get the list of raw records in an array
2015-09-08 17:27:33 +02:00

36 lines
893 B
PHP

<?php
namespace Amp\Dns\Test;
class IntegrationTest extends \PHPUnit_Framework_TestCase {
protected function setUp() {
\Amp\reactor(\Amp\driver());
}
/**
* @group internet
*/
public function testResolve() {
\Amp\run(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"
);
}
});
}
}