MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:uwendel Date:September 14 2007 10:12am
Subject:PHP mysqlnd svn commit: r1043 - trunk/tests/ext/mysqli
View as plain text  
Author: uwendel
Date: 2007-09-14 12:12:36 +0200 (Fri, 14 Sep 2007)
New Revision: 1043

Added:
   trunk/tests/ext/mysqli/mysqli_options_openbasedir.phpt
Modified:
   trunk/tests/ext/mysqli/mysqli_set_local_infile_default.phpt
   trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt
   trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt
   trunk/tests/ext/mysqli/mysqli_stmt_bind_result.phpt
Log:
Code coverage changes.


Added: trunk/tests/ext/mysqli/mysqli_options_openbasedir.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_options_openbasedir.phpt	2007-09-14 08:58:38 UTC (rev
1042)
+++ trunk/tests/ext/mysqli/mysqli_options_openbasedir.phpt	2007-09-14 10:12:36 UTC (rev
1043)
@@ -0,0 +1,24 @@
+--TEST--
+mysqli_options() - MYSQLI_OPT_LOCAL_INFILE and open_basedir
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--INI--
+open_basedir="."
+--FILE--
+<?php
+	require_once('connect.inc');
+	if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+
+	if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
+		printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
+
+	mysqli_close($link);
+	print "done!";
+?>
+--EXPECTF--
+done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_default.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_set_local_infile_default.phpt	2007-09-14 08:58:38 UTC
(rev 1042)
+++ trunk/tests/ext/mysqli/mysqli_set_local_infile_default.phpt	2007-09-14 10:12:36 UTC
(rev 1043)
@@ -10,8 +10,6 @@
 	die("skip - function not available.");
 
 require_once('connect.inc');
-if (!$TEST_EXPERIMENTAL)
-	die("skip - experimental (= unsupported) feature");
 ?>
 --INI--
 mysqli.allow_local_infile=1
@@ -27,6 +25,10 @@
 	if (!is_null($tmp = @mysqli_set_local_infile_default($link)))
 		printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
+	$link = new mysqli();
+	if (!is_null($tmp = @mysqli_set_local_infile_default($link)))
+		printf("[002a] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+
 	include("table.inc");
 
 	if (!is_null($tmp = @mysqli_set_local_infile_default($link, 'foo')))

Modified: trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt	2007-09-14 08:58:38 UTC (rev 1042)
+++ trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt	2007-09-14 10:12:36 UTC (rev 1043)
@@ -28,25 +28,39 @@
 	require('table.inc');
 
 	$valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
-	if (mysqli_get_client_version() > 50003)
+	if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) {
 		$valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+		$valid_attr[] =	MYSQLI_CURSOR_TYPE_NO_CURSOR;
+		$valid_attr[] =	MYSQLI_CURSOR_TYPE_READ_ONLY;
+		$valid_attr[] =	MYSQLI_CURSOR_TYPE_FOR_UPDATE;
+		$valid_attr[] =	MYSQLI_CURSOR_TYPE_SCROLLABLE;
+	}
 
-/* prefetch isn't supported
-		if (mysqli_get_client_version() > 50007)
-				$valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
-*/
-	do {
-		$invalid_attr = mt_rand(-10000, 10000);
-	} while (in_array($invalid_attr, $valid_attr));
+	if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND)
+		$valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
 
+
 	$stmt = mysqli_stmt_init($link);
 	if (!is_null($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
 		printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
 	$stmt->prepare("SELECT * FROM test");
-	if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
-		printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+	mt_srand(microtime(true));
+	for ($i = -100; $i < 1000; $i++) {
+		if (in_array($i, $valid_attr))
+			continue;
+		$invalid_attr = $i;
+		if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
+			printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr,
gettype($tmp), $tmp);
+	}
 
+	for ($i = 0; $i < 10; $i++) {
+		do {
+			$invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX);
+		} while (in_array($invalid_attr, $valid_attr));
+		if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
+			printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr,
gettype($tmp), $tmp);
+	}
 	$stmt->close();
 
 	//

Modified: trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt	2007-09-14 08:58:38 UTC (rev 1042)
+++ trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt	2007-09-14 10:12:36 UTC (rev 1043)
@@ -44,6 +44,9 @@
 	libmysql gives a less descriptive error message but mysqlnd,
 	we did not unify the error messages but ignore this slight difference silently
 	*/
+	if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
+		printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
 	if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
 		printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
 

Modified: trunk/tests/ext/mysqli/mysqli_stmt_bind_result.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_bind_result.phpt	2007-09-14 08:58:38 UTC (rev 1042)
+++ trunk/tests/ext/mysqli/mysqli_stmt_bind_result.phpt	2007-09-14 10:12:36 UTC (rev 1043)
@@ -61,6 +61,7 @@
 	}
 	mysqli_stmt_close($stmt);
 
+
 	function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type,
$bind_value, $offset, $type_hint = null) {
 
 		if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
@@ -294,6 +295,16 @@
 	if (!is_null($tmp = @mysqli_bind_result()))
 		printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
+	$stmt = mysqli_stmt_init($link);
+	if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
+		printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+	$id = null;
+	if (false !== @mysqli_stmt_bind_result($stmt, $id))
+		printf("[3002] Bind result should not be allowed");
+
+	mysqli_stmt_close($stmt);
+
 	mysqli_close($link);
 	print "done!";
 ?>

Thread
PHP mysqlnd svn commit: r1043 - trunk/tests/ext/mysqliuwendel14 Sep