mysqli_close_oo.phpt 959 B

123456789101112131415161718192021222324252627282930313233343536
  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 (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
  15. printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  16. $host, $user, $db, $port, $socket);
  17. if (!is_null($tmp = @$mysqli->close($link)))
  18. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  19. $tmp = $mysqli->close();
  20. if (true !== $tmp)
  21. printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
  22. if (!is_null($tmp = @$mysqli->close()))
  23. printf("[004] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
  24. if (!is_null($tmp = @$mysqli->query("SELECT 1")))
  25. printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  26. print "done!";
  27. ?>
  28. --EXPECTF--
  29. done!