From: Ulf Wendel Date: Thu, 24 Sep 2009 08:19:56 +0000 (+0000) Subject: Coverage for the OO variants of some functions X-Git-Tag: php-5.3.2RC1~453 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=057a62fc52e709ddae9ba5ff3d79eb91516c8eea;p=php Coverage for the OO variants of some functions --- diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt index 9141469967..2e6d9c2fd1 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt @@ -15,8 +15,6 @@ Those tests go into the details and are aimed to be a development tool, no more. */ if (!$IS_MYSQLND) die("skip Test has been written for the latest version of mysqlnd only"); -if ($MYSQLND_VERSION < 50005) - die("skip Test requires mysqlnd Revision 5.0.4 or newer"); ?> --FILE-- get_connection_stats()) || empty($info)) + printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + + foreach ($info as $k => &$v) { + if (strpos($k, "mem_") === 0) { + $v = 0; + } + } + + if ($info !== $info2) { + printf("[007] The hashes should be identical except of the memory related fields\n"); + var_dump($info); + var_dump($info2); + } + mysqli_close($link); include "table.inc"; if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) - printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); + printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info); if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2)) - printf("[007] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); + printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2); // assuming the test is run in a plain-vanilla CLI environment if ($info === $info2) { - printf("[008] The hashes should not be identical\n"); + printf("[010] The hashes should not be identical\n"); var_dump($info); var_dump($info2); } diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt index 1bfae4bdbe..93e3b210bf 100644 --- a/ext/mysqli/tests/mysqli_poll.phpt +++ b/ext/mysqli/tests/mysqli_poll.phpt @@ -53,14 +53,25 @@ if (!$IS_MYSQLND) printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); - function poll_async($offset, $links, $errors, $reject, $exp_ready) { - - if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) - printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", - $exp_ready, $tmp); + function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { + + if ($use_oo_syntax) { + if ($exp_ready !== ($tmp = $link->poll($links, $errors, $reject, 0, 1000))) + printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", + $exp_ready, $tmp); + } else { + if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) + printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", + $exp_ready, $tmp); + } foreach ($links as $mysqli) { - if (is_object($res = mysqli_reap_async_query($mysqli))) { + if ($use_oo_syntax) { + $res = $mysqli->reap_async_query(); + } else { + $res = mysqli_reap_async_query($mysqli); + } + if (is_object($res)) { printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset); } else if (mysqli_errno($mysqli) > 0) { printf("[%03d + 3] Error indicated through links array: %d/%s", @@ -85,7 +96,14 @@ if (!$IS_MYSQLND) $links = array($link); $errors = array($link); $reject = array($link); - poll_async(10, $links, $errors, $reject, 0); + poll_async(10, $link, $links, $errors, $reject, 0, false); + mysqli_close($link); + + $link = get_connection(); + $links = array($link); + $errors = array($link); + $reject = array($link); + poll_async(11, $link, $links, $errors, $reject, 0, true); mysqli_close($link); // Connections on which no query has been send - 2 @@ -94,7 +112,7 @@ if (!$IS_MYSQLND) $links = array($link, $link); $errors = array($link, $link); $reject = array(); - poll_async(11, $links, $errors, $reject, 0); + poll_async(12, $link, $links, $errors, $reject, 0, false); // Connections on which no query has been send - 3 // Difference: pass two connections @@ -102,7 +120,7 @@ if (!$IS_MYSQLND) $links = array($link, get_connection()); $errors = array($link, $link); $reject = array(); - poll_async(12, $links, $errors, $reject, 0); + poll_async(13, $link, $links, $errors, $reject, 0, false); // Reference mess... $link = get_connection(); @@ -110,15 +128,16 @@ if (!$IS_MYSQLND) $errors = array($link); $ref_errors =& $errors; $reject = array(); - poll_async(13, $links, $ref_errors, $reject, 0); + poll_async(14, $link, $links, $ref_errors, $reject, 0, false); print "done!"; ?> --EXPECTF-- [010 + 6] Rejecting thread %d: 0/ [011 + 6] Rejecting thread %d: 0/ -[011 + 6] Rejecting thread %d: 0/ [012 + 6] Rejecting thread %d: 0/ [012 + 6] Rejecting thread %d: 0/ [013 + 6] Rejecting thread %d: 0/ +[013 + 6] Rejecting thread %d: 0/ +[014 + 6] Rejecting thread %d: 0/ done!