mysqli_close.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. mysqli_close()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifemb.inc');
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once("connect.inc");
  12. $tmp = NULL;
  13. $link = NULL;
  14. if (!is_null($tmp = @mysqli_close()))
  15. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  16. if (!is_null($tmp = @mysqli_close($link, $link)))
  17. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  18. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  19. printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  20. $host, $user, $db, $port, $socket);
  21. $tmp = @mysqli_close(NULL);
  22. if (NULL !== $tmp)
  23. printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
  24. $tmp = mysqli_close($link);
  25. if (true !== $tmp)
  26. printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
  27. if (!is_null($tmp = @mysqli_query($link, "SELECT 1")))
  28. printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  29. print "done!";
  30. ?>
  31. --EXPECTF--
  32. done!