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

32 lines
847 B
PHP
Raw Normal View History

2016-08-23 23:20:25 -05:00
<?php declare(strict_types = 1);
2014-09-24 13:31:27 -04:00
namespace Amp\Dns\Test;
2014-09-23 16:47:55 -04:00
class IntegrationTest extends \PHPUnit_Framework_TestCase {
/**
* @group internet
*/
2015-08-01 22:18:44 -04:00
public function testResolve() {
2016-08-02 23:57:40 +02:00
\Amp\execute(function () {
2015-08-01 22:18:44 -04:00
$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];
2015-08-01 22:18:44 -04:00
$inAddr = @\inet_pton($addr);
$this->assertNotFalse(
$inAddr,
"Server name $name did not resolve to a valid IP address"
);
}
});
}
}