mysqli_send_query.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. mysqli_send_query()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifemb.inc');
  7. require_once('skipifconnectfailure.inc');
  8. if (!function_exists('mysqli_send_query')) {
  9. die("skip mysqli_send_query() not available");
  10. }
  11. require_once('connect.inc');
  12. if (!$TEST_EXPERIMENTAL)
  13. die("skip - experimental (= unsupported) feature");
  14. ?>
  15. --FILE--
  16. <?php
  17. /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
  18. require_once("connect.inc");
  19. $tmp = NULL;
  20. $link = NULL;
  21. if (NULL !== ($tmp = @mysqli_send_query()))
  22. printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
  23. if (NULL !== ($tmp = @mysqli_send_query($link)))
  24. printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
  25. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
  26. printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  27. $host, $user, $db, $port, $socket);
  28. }
  29. $query = array();
  30. if (NULL !== ($tmp = @mysqli_send_query($link, $query)))
  31. printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
  32. if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1')))
  33. printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
  34. mysqli_close($link);
  35. if (NULL !== ($tmp = mysqli_send_query($link, 'SELECT 1')))
  36. printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  37. print "done!";
  38. ?>
  39. --EXPECTF--
  40. Warning: mysqli_send_query(): Couldn't fetch mysqli in %s on line %d
  41. done!