Annotation of embedaddon/php/ext/mysqli/tests/mysqli_debug_ini.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli_debug() - enabling trace with ini setting
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifemb.inc');
! 7: require_once('skipifconnectfailure.inc');
! 8:
! 9: if (!function_exists('mysqli_debug'))
! 10: die("skip mysqli_debug() not available");
! 11:
! 12: if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
! 13: die("skip: can't say for sure if mysqli_debug works");
! 14:
! 15: if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
! 16: die("skip: debug functionality not enabled");
! 17:
! 18: require_once('connect.inc');
! 19: if (!$IS_MYSQLND || ($MYSQLND_VERSION < 50004))
! 20: die("skip needs mysqlnd version/revision 5.0.4");
! 21:
! 22: if (!$fp = @fopen('/tmp/mysqli_debug_phpt.trace', 'w'))
! 23: die("skip PHP cannot create a file in /tmp/mysqli_debug_phpt");
! 24: else
! 25: fclose($fp);
! 26: @unlink("/tmp/mysqli_debug_phpt.trace");
! 27: ?>
! 28: --INI--
! 29: mysqlnd.debug="t:O,/tmp/mysqli_debug_phpt.trace"
! 30: --FILE--
! 31: <?php
! 32: require_once('connect.inc');
! 33: require_once('table.inc');
! 34:
! 35: var_dump(ini_get('mysqlnd.debug'));
! 36:
! 37: $trace_file = '/tmp/mysqli_debug_phpt.trace';
! 38: clearstatcache();
! 39: if (!file_exists($trace_file))
! 40: printf("[003] Trace file '%s' has not been created\n", $trace_file);
! 41: if (filesize($trace_file) < 50)
! 42: printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
! 43: $trace_file,
! 44: filesize($trace_file));
! 45:
! 46: mysqli_close($link);
! 47: unlink($trace_file);
! 48:
! 49: print "done!";
! 50: ?>
! 51: --EXPECTF--
! 52: string(32) "t:O,/tmp/mysqli_debug_phpt.trace"
! 53: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>