mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
add ares_gethostbyname testcase
This commit is contained in:
parent
3abb548c43
commit
4d90f621f8
4
php_uv.c
4
php_uv.c
@ -3095,6 +3095,10 @@ PHP_FUNCTION(ares_gethostbyname)
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(uv, php_uv_ares_t *, &handle, -1, PHP_UV_ARES_RESOURCE_NAME, uv_ares_handle);
|
||||
if (uv->gethostbyname_cb != NULL) {
|
||||
zval_ptr_dtor(&uv->gethostbyname_cb);
|
||||
uv->gethostbyname_cb = NULL;
|
||||
}
|
||||
Z_ADDREF_P(byname_cb);
|
||||
uv->gethostbyname_cb = byname_cb;
|
||||
|
||||
|
35
tests/200-ares_gethostbyname.phpt
Normal file
35
tests/200-ares_gethostbyname.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Check for ares_gethostbyname
|
||||
--FILE--
|
||||
<?php
|
||||
$uv = uv_ares_init_options(uv_default_loop(), array(
|
||||
"servers" => array(
|
||||
"8.8.8.8"
|
||||
),
|
||||
"port"=>53
|
||||
),null);
|
||||
|
||||
ares_gethostbyname($uv,"php.net",AF_INET, function($name, $addr){
|
||||
echo $name . PHP_EOL;
|
||||
if (is_array($addr)) {
|
||||
echo "OK";
|
||||
} else {
|
||||
echo "FAILED";
|
||||
}
|
||||
});
|
||||
|
||||
ares_gethostbyname($uv,"php.net",AF_INET, function($name, $addr){
|
||||
echo $name . PHP_EOL;
|
||||
if (is_array($addr)) {
|
||||
echo "OK" . PHP_EOL;
|
||||
} else {
|
||||
echo "FAILED: 2nd parameter does not array" . PHP_EOL;
|
||||
}
|
||||
});
|
||||
|
||||
uv_run();
|
||||
--EXPECT--
|
||||
php.net
|
||||
OK
|
||||
php.net
|
||||
OK
|
Loading…
Reference in New Issue
Block a user