Author: uwendel
Date: 2007-07-12 16:08:44 +0200 (Thu, 12 Jul 2007)
New Revision: 734
Modified:
trunk/tests/ext/mysql/mysql_constants.phpt
trunk/tests/ext/mysql/mysql_list_tables.phpt
trunk/tests/ext/mysql/mysql_phpinfo.phpt
trunk/tests/ext/mysql/mysql_set_charset.phpt
Log:
php.net whitespace only
Modified: trunk/tests/ext/mysql/mysql_constants.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_constants.phpt 2007-07-12 13:54:25 UTC (rev 733)
+++ trunk/tests/ext/mysql/mysql_constants.phpt 2007-07-12 14:08:44 UTC (rev 734)
@@ -3,60 +3,60 @@
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
-<?php
- require("connect.inc");
- require("table.inc");
-
- $constants = get_defined_constants(true);
- sort($constants);
-
- $expected_constants = array(
- 'MYSQL_ASSOC' => true,
- 'MYSQL_NUM' => true,
- 'MYSQL_BOTH' => true,
- 'MYSQL_CLIENT_COMPRESS' => true,
- 'MYSQL_CLIENT_INTERACTIVE' => true,
- 'MYSQL_CLIENT_IGNORE_SPACE' => true,
- );
-
- $version = mysql_get_server_info($link);
- if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches))
- printf("[001] Cannot get server version\n");
- $version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3];
-
- if ($version > 400) {
- $expected_constants = array_merge($expected_constants, array(
- "MYSQL_CLIENT_SSL" => true,
- ));
- }
-
-
- $unexpected_constants = array();
-
- foreach ($constants as $group => $consts) {
- foreach ($consts as $name => $value) {
- if (stristr($name, 'mysql') && !stristr($name, 'mysqli')) {
- $name = strtoupper($name);
- if (isset($expected_constants[$name])) {
- unset($expected_constants[$name]);
- } else {
- $unexpected_constants[$name] = $name;
- }
- }
- }
- }
+<?php
+require("connect.inc");
+require("table.inc");
- if (!empty($unexpected_constants)) {
- printf("Dumping list of unexpected constants\n");
- var_dump($unexpected_constants);
- }
+$constants = get_defined_constants(true);
+sort($constants);
- if (!empty($expected_constants)) {
- printf("Dumping list of missing constants\n");
- var_dump($expected_constants);
- }
+$expected_constants = array(
+ 'MYSQL_ASSOC' => true,
+ 'MYSQL_NUM' => true,
+ 'MYSQL_BOTH' => true,
+ 'MYSQL_CLIENT_COMPRESS' => true,
+ 'MYSQL_CLIENT_INTERACTIVE' => true,
+ 'MYSQL_CLIENT_IGNORE_SPACE' => true,
+);
- print "done!";
+$version = mysql_get_server_info($link);
+if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches))
+ printf("[001] Cannot get server version\n");
+$version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3];
+
+if ($version > 400) {
+ $expected_constants = array_merge($expected_constants, array(
+ "MYSQL_CLIENT_SSL" => true,
+ ));
+}
+
+
+$unexpected_constants = array();
+
+foreach ($constants as $group => $consts) {
+ foreach ($consts as $name => $value) {
+ if (stristr($name, 'mysql') && !stristr($name, 'mysqli')) {
+ $name = strtoupper($name);
+ if (isset($expected_constants[$name])) {
+ unset($expected_constants[$name]);
+ } else {
+ $unexpected_constants[$name] = $name;
+ }
+ }
+ }
+}
+
+if (!empty($unexpected_constants)) {
+ printf("Dumping list of unexpected constants\n");
+ var_dump($unexpected_constants);
+}
+
+if (!empty($expected_constants)) {
+ printf("Dumping list of missing constants\n");
+ var_dump($expected_constants);
+}
+
+print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysql/mysql_list_tables.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_list_tables.phpt 2007-07-12 13:54:25 UTC (rev 733)
+++ trunk/tests/ext/mysql/mysql_list_tables.phpt 2007-07-12 14:08:44 UTC (rev 734)
@@ -1,81 +1,80 @@
--TEST--
mysql_list_tables()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
?>
--FILE--
<?php
- include_once "connect.inc";
+include_once "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysql_list_tables()))
- printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+$tmp = NULL;
+$link = NULL;
- if (NULL !== ($tmp = @mysql_list_tables('too', 'many', 'arguments')))
- printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = @mysql_list_tables(NULL)))
- printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = @mysql_list_tables($db, NULL)))
- printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- require_once('table.inc');
-
- if (!$res_def = @mysql_list_tables($db))
- printf("[005] [%d] %s\n", mysql_errno(), mysql_error());
-
- if (!$res = @mysql_list_tables($db, $link))
- printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
-
- if (!$res_query = mysql_query("SHOW TABLES", $link))
- printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link));
-
- $tables_def = $tables = $tables_query = array();
-
- while ($row = mysql_fetch_assoc($res_def))
- $tables_def[] = $row;
- mysql_free_result($res_def);
-
- while ($row = mysql_fetch_assoc($res))
- $tables[] = $row;
- mysql_free_result($res);
-
- while ($row = mysql_fetch_assoc($res_query))
- $tables_query[] = $row;
- mysql_free_result($res_query);
-
- if ($tables_def !== $tables) {
- printf("[008] Got different table lists for default link and specified link\n");
- var_dump($tables_def);
- var_dump($tables);
- }
-
- $list1 = $list2 = array();
- foreach ($tables as $k => $tlist)
- foreach ($tlist as $k => $table)
- $list1[] = $table;
-
- foreach ($tables_query as $k => $tlist)
- foreach ($tlist as $k => $table)
- $list2[] = $table;
-
- if ($list1 !== $list2) {
- printf("[009] Got different results for mysql_list_tables() and SHOW TABLES\n");
- var_dump($list1);
- var_dump($list2);
- }
-
- if (!in_array('test', $list1))
- printf("[010] Table lists seem to be wrong. Check manually.\n");
-
- mysql_close($link);
-
+if (NULL !== ($tmp = @mysql_list_tables()))
+ printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- print "done!\n";
+if (NULL !== ($tmp = @mysql_list_tables('too', 'many', 'arguments')))
+ printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+
+if (false !== ($tmp = @mysql_list_tables(NULL)))
+ printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+if (false !== ($tmp = @mysql_list_tables($db, NULL)))
+ printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+require_once('table.inc');
+
+if (!$res_def = @mysql_list_tables($db))
+ printf("[005] [%d] %s\n", mysql_errno(), mysql_error());
+
+if (!$res = @mysql_list_tables($db, $link))
+ printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
+if (!$res_query = mysql_query("SHOW TABLES", $link))
+ printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
+$tables_def = $tables = $tables_query = array();
+
+while ($row = mysql_fetch_assoc($res_def))
+ $tables_def[] = $row;
+mysql_free_result($res_def);
+
+while ($row = mysql_fetch_assoc($res))
+ $tables[] = $row;
+mysql_free_result($res);
+
+while ($row = mysql_fetch_assoc($res_query))
+ $tables_query[] = $row;
+mysql_free_result($res_query);
+
+if ($tables_def !== $tables) {
+ printf("[008] Got different table lists for default link and specified link\n");
+ var_dump($tables_def);
+ var_dump($tables);
+}
+
+$list1 = $list2 = array();
+foreach ($tables as $k => $tlist)
+ foreach ($tlist as $k => $table)
+ $list1[] = $table;
+
+foreach ($tables_query as $k => $tlist)
+ foreach ($tlist as $k => $table)
+ $list2[] = $table;
+
+if ($list1 !== $list2) {
+ printf("[009] Got different results for mysql_list_tables() and SHOW TABLES\n");
+ var_dump($list1);
+ var_dump($list2);
+}
+
+if (!in_array('test', $list1))
+ printf("[010] Table lists seem to be wrong. Check manually.\n");
+
+mysql_close($link);
+
+print "done!\n";
?>
--EXPECTF--
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysql/mysql_phpinfo.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_phpinfo.phpt 2007-07-12 13:54:25 UTC (rev 733)
+++ trunk/tests/ext/mysql/mysql_phpinfo.phpt 2007-07-12 14:08:44 UTC (rev 734)
@@ -4,70 +4,70 @@
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- include_once("connect.inc");
-
- @ob_clean();
- ob_start();
- phpinfo();
- $phpinfo = ob_get_contents();
- ob_end_clean();
-
- /* all versions should at least dump this minimum information */
- if (!stristr($phpinfo, "mysql support"))
- printf("[001] ext/mysql should have exposed itself.\n");
-
- if (!stristr($phpinfo, "client api library version"))
- printf("[002] ext/mysql should have exposed the library version.\n");
-
- if (!stristr($phpinfo, "mysql.default_host"))
- printf("[003] php.ini setting mysql.default_host not shown.\n");
+include_once("connect.inc");
- if (!stristr($phpinfo, "mysql.default_port"))
- printf("[004] php.ini setting mysql.default_port not shown.\n");
+@ob_clean();
+ob_start();
+phpinfo();
+$phpinfo = ob_get_contents();
+ob_end_clean();
- if (!stristr($phpinfo, "mysql.default_password"))
- printf("[005] php.ini setting mysql.default_password not shown.\n");
+/* all versions should at least dump this minimum information */
+if (!stristr($phpinfo, "mysql support"))
+ printf("[001] ext/mysql should have exposed itself.\n");
- if (!stristr($phpinfo, "mysql.default_socket"))
- printf("[006] php.ini setting mysql.default_socket not shown.\n");
+if (!stristr($phpinfo, "client api library version"))
+ printf("[002] ext/mysql should have exposed the library version.\n");
- if (!stristr($phpinfo, "mysql.default_user"))
- printf("[007] php.ini setting mysql.default_user not shown.\n");
+if (!stristr($phpinfo, "mysql.default_host"))
+ printf("[003] php.ini setting mysql.default_host not shown.\n");
- if (!stristr($phpinfo, "mysql.max_links"))
- printf("[008] php.ini setting mysql.max_links not shown.\n");
+if (!stristr($phpinfo, "mysql.default_port"))
+ printf("[004] php.ini setting mysql.default_port not shown.\n");
- if (!stristr($phpinfo, "mysql.max_persistent"))
- printf("[009] php.ini setting mysql.max_persistent not shown.\n");
-
- if (!stristr($phpinfo, "mysql.connect_timeout"))
- printf("[010] php.ini setting mysql.connect_timeout not shown.\n");
+if (!stristr($phpinfo, "mysql.default_password"))
+ printf("[005] php.ini setting mysql.default_password not shown.\n");
- if (!stristr($phpinfo, "mysql.allow_persistent"))
- printf("[011] php.ini setting mysql.allow_persistent not shown.\n");
-
- if ($IS_MYSQLND) {
- $expected = array(
- 'client statistics',
- 'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
- 'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
- 'non_result_set_queries', 'no_index_used', 'bad_index_used',
- 'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
- 'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
- 'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
- 'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
- 'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
- 'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
- 'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
- 'put_hits', 'put_misses', 'get_hits', 'get_misses',
- 'size', 'free_items', 'references', 'mysql.cache_size',
- );
- foreach ($expected as $k => $entry)
- if (!stristr($phpinfo, $entry))
- printf("[012] Could not find entry for '%s'\n", $entry);
- }
-
- print "done!";
+if (!stristr($phpinfo, "mysql.default_socket"))
+ printf("[006] php.ini setting mysql.default_socket not shown.\n");
+
+if (!stristr($phpinfo, "mysql.default_user"))
+ printf("[007] php.ini setting mysql.default_user not shown.\n");
+
+if (!stristr($phpinfo, "mysql.max_links"))
+ printf("[008] php.ini setting mysql.max_links not shown.\n");
+
+if (!stristr($phpinfo, "mysql.max_persistent"))
+ printf("[009] php.ini setting mysql.max_persistent not shown.\n");
+
+if (!stristr($phpinfo, "mysql.connect_timeout"))
+ printf("[010] php.ini setting mysql.connect_timeout not shown.\n");
+
+if (!stristr($phpinfo, "mysql.allow_persistent"))
+ printf("[011] php.ini setting mysql.allow_persistent not shown.\n");
+
+if ($IS_MYSQLND) {
+ $expected = array(
+ 'client statistics',
+ 'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
+ 'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
+ 'non_result_set_queries', 'no_index_used', 'bad_index_used',
+ 'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
+ 'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
+ 'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
+ 'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
+ 'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
+ 'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
+ 'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
+ 'put_hits', 'put_misses', 'get_hits', 'get_misses',
+ 'size', 'free_items', 'references', 'mysql.cache_size',
+ );
+ foreach ($expected as $k => $entry)
+ if (!stristr($phpinfo, $entry))
+ printf("[012] Could not find entry for '%s'\n", $entry);
+}
+
+print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysql/mysql_set_charset.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_set_charset.phpt 2007-07-12 13:54:25 UTC (rev 733)
+++ trunk/tests/ext/mysql/mysql_set_charset.phpt 2007-07-12 14:08:44 UTC (rev 734)
@@ -1,55 +1,55 @@
--TEST--
mysql_set_charset() - STUB, function usage not recommended
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
if (!function_exists('mysql_set_charset'))
- die("skip Function not available");
+ die("skip Function not available");
?>
--FILE--
<?php
- include_once "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysql_set_charset()))
- printf("[001] Expecting NULL got %s/%s\n", $tmp, gettype($tmp));
-
- if (false !== ($tmp = @mysql_set_charset($link)))
- printf("[002] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp));
+include_once "connect.inc";
- if (false !== ($tmp = @mysql_set_charset(-1)))
- printf("[003] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp));
+$tmp = NULL;
+$link = NULL;
- if (!is_null($tmp = @mysql_set_charset('somecharset', $link)))
- printf("[004] Expecting NULL got %s/%s\n", $tmp, gettype($tmp));
-
- if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+if (!is_null($tmp = @mysql_set_charset()))
+ printf("[001] Expecting NULL got %s/%s\n", $tmp, gettype($tmp));
- /* unicode mode should throw a warning */
- $tmp = mysql_set_charset('uFt8', $link);
-
- if (ini_get('unicode.semantics'))
- $expect = false;
- else
- $expect = true;
-
- $charsets = array('latin1', 'latin2');
- foreach ($charsets as $k => $charset) {
- if (!($res = mysql_query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset),
$link)))
- continue;
- mysql_free_result($res);
- if ($expect !== ($tmp = @mysql_set_charset($charset, $link)))
- printf("[006] Expecting %s/%s got %s/%s\n",
- gettype($expect), $expect,
- gettype($tmp), $tmp);
- }
-
- mysql_close($link);
- print "done!";
+if (false !== ($tmp = @mysql_set_charset($link)))
+ printf("[002] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp));
+
+if (false !== ($tmp = @mysql_set_charset(-1)))
+ printf("[003] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp));
+
+if (!is_null($tmp = @mysql_set_charset('somecharset', $link)))
+ printf("[004] Expecting NULL got %s/%s\n", $tmp, gettype($tmp));
+
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+/* unicode mode should throw a warning */
+$tmp = mysql_set_charset('uFt8', $link);
+
+if (ini_get('unicode.semantics'))
+ $expect = false;
+else
+ $expect = true;
+
+$charsets = array('latin1', 'latin2');
+foreach ($charsets as $k => $charset) {
+ if (!($res = mysql_query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset), $link)))
+ continue;
+ mysql_free_result($res);
+ if ($expect !== ($tmp = @mysql_set_charset($charset, $link)))
+ printf("[006] Expecting %s/%s got %s/%s\n",
+ gettype($expect), $expect,
+ gettype($tmp), $tmp);
+}
+
+mysql_close($link);
+print "done!";
?>
--EXPECTF--
done!
| Thread |
|---|
| • PHP mysqlnd svn commit: r734 - trunk/tests/ext/mysql | uwendel | 12 Jul |