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

36 lines
893 B
PHP
Raw Normal View History

<?php
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 {
2015-08-01 22:18:44 -04:00
protected function setUp() {
\Amp\reactor(\Amp\driver());
}
/**
* @group internet
*/
2015-08-01 22:18:44 -04:00
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];
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"
);
}
});
}
}