Annotation of embedaddon/php/ext/mysql/tests/mysql_ping.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysql_ping()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: include_once "connect.inc";
! 11:
! 12: $tmp = NULL;
! 13: $link = NULL;
! 14:
! 15: require('table.inc');
! 16:
! 17: if (!is_null($tmp = @mysql_ping($link, $link)))
! 18: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 19:
! 20: var_dump(mysql_ping($link));
! 21:
! 22: // provoke an error to check if mysql_ping resets it
! 23: $res = mysql_query('SELECT * FROM unknown_table', $link);
! 24: if (!($errno = mysql_errno($link)))
! 25: printf("[002] Statement should have caused an error\n");
! 26:
! 27: var_dump(mysql_ping($link));
! 28:
! 29: if ($errno === mysql_errno($link))
! 30: printf("[003] Error codes should have been reset\n");
! 31:
! 32: var_dump(mysql_ping());
! 33: mysql_close($link);
! 34:
! 35: if (false !== ($tmp = mysql_ping($link)))
! 36: printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
! 37:
! 38: print "done!";
! 39: ?>
! 40: --CLEAN--
! 41: <?php
! 42: require_once("clean_table.inc");
! 43: ?>
! 44: --EXPECTF--
! 45: bool(true)
! 46: bool(true)
! 47: bool(true)
! 48:
! 49: Warning: mysql_ping(): %d is not a valid MySQL-Link resource in %s on line %d
! 50: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>