xref: /PHP-5.4/ext/mysql/tests/mysql_phpinfo.phpt (revision cfac5f5b)
1--TEST--
2phpinfo() mysql section
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10include_once("connect.inc");
11
12@ob_clean();
13ob_start();
14phpinfo();
15$phpinfo = ob_get_contents();
16ob_end_clean();
17
18/* all versions should at least dump this minimum information */
19if (!stristr($phpinfo, "mysql support"))
20	printf("[001] ext/mysql should have exposed itself.\n");
21
22if (!stristr($phpinfo, "client api version"))
23	printf("[002] ext/mysql should have exposed the library version.\n");
24
25if (!stristr($phpinfo, "mysql.default_host"))
26	printf("[003] php.ini setting mysql.default_host not shown.\n");
27
28if (!stristr($phpinfo, "mysql.default_port"))
29	printf("[004] php.ini setting mysql.default_port not shown.\n");
30
31if (!stristr($phpinfo, "mysql.default_password"))
32	printf("[005] php.ini setting mysql.default_password not shown.\n");
33
34if (!stristr($phpinfo, "mysql.default_socket"))
35	printf("[006] php.ini setting mysql.default_socket not shown.\n");
36
37if (!stristr($phpinfo, "mysql.default_user"))
38	printf("[007] php.ini setting mysql.default_user not shown.\n");
39
40if (!stristr($phpinfo, "mysql.max_links"))
41	printf("[008] php.ini setting mysql.max_links not shown.\n");
42
43if (!stristr($phpinfo, "mysql.max_persistent"))
44	printf("[009] php.ini setting mysql.max_persistent not shown.\n");
45
46if (!stristr($phpinfo, "mysql.connect_timeout"))
47	printf("[010] php.ini setting mysql.connect_timeout not shown.\n");
48
49if (!stristr($phpinfo, "mysql.allow_persistent"))
50	printf("[011] php.ini setting mysql.allow_persistent not shown.\n");
51
52if ($IS_MYSQLND) {
53	$expected = array(
54		'mysqlnd statistics',
55		'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
56		'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
57		'non_result_set_queries', 'no_index_used', 'bad_index_used',
58		'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
59		'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
60		'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
61		'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
62		'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
63		'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
64		'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
65		'size',
66	);
67	foreach ($expected as $k => $entry)
68		if (!stristr($phpinfo, $entry))
69			printf("[012] Could not find entry for '%s'\n", $entry);
70}
71
72print "done!";
73?>
74--EXPECTF--
75done!
76