uw Thu Jul 12 20:49:29 2007 UTC
Modified files:
/php-src/ext/mysqli/tests 020.phpt 021.phpt 022.phpt 023.phpt
024.phpt 025.phpt 026.phpt 027.phpt
028.phpt 029.phpt
Log:
I forgot to mention: some will fail. In particular in unicode mode.
Next 10 in row to be tweaked:
- take connection parameter from connect.inc
- use proper UEXPECTF
- have 'print "done!"' or similar at the end to detect crashes
- whitespace changes where needed
- take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0
- understand return value checking as sometime that makes you type
more when you write but makes you happy when you debug
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/020.phpt?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/mysqli/tests/020.phpt
diff -u php-src/ext/mysqli/tests/020.phpt:1.8
php-src/ext/mysqli/tests/020.phpt:1.9
--- php-src/ext/mysqli/tests/020.phpt:1.8 Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/020.phpt Thu Jul 12 20:49:29 2007
@@ -4,27 +4,30 @@
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
+ /* NOTE: There's an option in mysqlnd which controls if data and
+ time are returned as unicode or not. Consider this if you consider
+ adding a UEXPECTF to the test. */
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
-
+
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
- mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
+ mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time,
+ c3 timestamp(14),
+ c4 year,
+ c5 datetime,
+ c6 timestamp(4),
c7 timestamp(6))");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES
(?,?,?,?,?,?,?)");
mysqli_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
- $d1 = "2002-01-02";
+ $d1 = "2002-01-02";
$d2 = "12:49:00";
$d3 = "2002-01-02 17:46:59";
$d4 = "2010";
@@ -37,9 +40,9 @@
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
-
- mysqli_execute($stmt);
+ mysqli_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
+
+ mysqli_execute($stmt);
mysqli_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
@@ -48,6 +51,8 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
array(7) {
@@ -66,3 +71,4 @@
[6]=>
%s(19) "1999-12-29 00:00:00"
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/021.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/021.phpt
diff -u php-src/ext/mysqli/tests/021.phpt:1.6
php-src/ext/mysqli/tests/021.phpt:1.7
--- php-src/ext/mysqli/tests/021.phpt:1.6 Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/021.phpt Thu Jul 12 20:49:29 2007
@@ -1,18 +1,18 @@
--TEST--
-mysqli bind_param+bind_result char/text
+mysqli bind_param+bind_result char/text
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES
(?,?)");
mysqli_bind_param($stmt, "ss", $q1, $q2);
@@ -32,11 +32,21 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
array(2) {
[0]=>
- %s(10) "1234567890"
+ string(10) "1234567890"
+ [1]=>
+ %s(14) "this is a test"
+}
+done!
+--UEXPECTF--
+array(2) {
+ [0]=>
+ unicode(10) "1234567890"
[1]=>
%s(14) "this is a test"
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/022.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/022.phpt
diff -u php-src/ext/mysqli/tests/022.phpt:1.6
php-src/ext/mysqli/tests/022.phpt:1.7
--- php-src/ext/mysqli/tests/022.phpt:1.6 Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/022.phpt Thu Jul 12 20:49:29 2007
@@ -1,18 +1,18 @@
--TEST--
-mysqli bind_param/bind_result char/text long
+mysqli bind_param/bind_result char/text long
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES
(?,?)");
@@ -36,11 +36,22 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
array(2) {
[0]=>
- %s(10) "1234567890"
+ string(10) "1234567890"
+ [1]=>
+ %s(13) "32K String ok"
+}
+done!
+--UEXPECTF--
+array(2) {
+ [0]=>
+ unicode(10) "1234567890"
[1]=>
%s(13) "32K String ok"
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/023.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/023.phpt
diff -u php-src/ext/mysqli/tests/023.phpt:1.6
php-src/ext/mysqli/tests/023.phpt:1.7
--- php-src/ext/mysqli/tests/023.phpt:1.6 Wed Jan 4 23:04:06 2006
+++ php-src/ext/mysqli/tests/023.phpt Thu Jul 12 20:49:29 2007
@@ -5,15 +5,15 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
c2 int unsigned,
c3 int,
c4 int,
@@ -45,6 +45,8 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -63,3 +65,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/024.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/024.phpt
diff -u php-src/ext/mysqli/tests/024.phpt:1.6
php-src/ext/mysqli/tests/024.phpt:1.7
--- php-src/ext/mysqli/tests/024.phpt:1.6 Wed Jan 4 23:04:06 2006
+++ php-src/ext/mysqli/tests/024.phpt Thu Jul 12 20:49:29 2007
@@ -5,15 +5,15 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
c2 smallint unsigned,
c3 smallint,
c4 smallint,
@@ -46,6 +46,7 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -64,3 +65,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/025.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/025.phpt
diff -u php-src/ext/mysqli/tests/025.phpt:1.6
php-src/ext/mysqli/tests/025.phpt:1.7
--- php-src/ext/mysqli/tests/025.phpt:1.6 Wed Jan 4 23:04:06 2006
+++ php-src/ext/mysqli/tests/025.phpt Thu Jul 12 20:49:29 2007
@@ -5,15 +5,15 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
c2 tinyint unsigned,
c3 tinyint not NULL,
c4 tinyint,
@@ -50,6 +50,8 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -68,3 +70,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/026.phpt?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/mysqli/tests/026.phpt
diff -u php-src/ext/mysqli/tests/026.phpt:1.8
php-src/ext/mysqli/tests/026.phpt:1.9
--- php-src/ext/mysqli/tests/026.phpt:1.8 Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/026.phpt Thu Jul 12 20:49:29 2007
@@ -1,19 +1,19 @@
--TEST--
-mysqli bind_param/bind_result with send_long_data
+mysqli bind_param/bind_result with send_long_data
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2
text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2
text)");
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES
(?,?)");
mysqli_bind_param($stmt, "sb", $c1, $c2);
@@ -39,11 +39,20 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
-?>
+ print "done!";
--EXPECTF--
array(2) {
[0]=>
- %s(10) "Hello Worl"
+ string(10) "Hello Worl"
+ [1]=>
+ string(99) "This is the first sentence. And this is the second sentence. And
finally this is the last sentence."
+}
+done!
+--UEXPECTF--
+array(2) {
+ [0]=>
+ unicode(10) "Hello Worl"
[1]=>
%s(99) "This is the first sentence. And this is the second sentence. And
finally this is the last sentence."
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/027.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysqli/tests/027.phpt
diff -u php-src/ext/mysqli/tests/027.phpt:1.4
php-src/ext/mysqli/tests/027.phpt:1.5
--- php-src/ext/mysqli/tests/027.phpt:1.4 Sat Dec 4 08:50:33 2004
+++ php-src/ext/mysqli/tests/027.phpt Thu Jul 12 20:49:29 2007
@@ -5,9 +5,9 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$status = mysqli_stat($link);
@@ -15,6 +15,8 @@
var_dump(strlen($status) > 0);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
bool(true)
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/028.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mysqli/tests/028.phpt
diff -u php-src/ext/mysqli/tests/028.phpt:1.6
php-src/ext/mysqli/tests/028.phpt:1.7
--- php-src/ext/mysqli/tests/028.phpt:1.6 Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/028.phpt Thu Jul 12 20:49:29 2007
@@ -5,15 +5,20 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$cset = substr(mysqli_character_set_name($link),0,6);
var_dump($cset);
mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
-%s(%d) "%s"
+string(%d) "%s"
+done!
+--UEXPECTF--
+unicode(%d) "%s"
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/029.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysqli/tests/029.phpt
diff -u php-src/ext/mysqli/tests/029.phpt:1.3
php-src/ext/mysqli/tests/029.phpt:1.4
--- php-src/ext/mysqli/tests/029.phpt:1.3 Sat Dec 4 08:50:33 2004
+++ php-src/ext/mysqli/tests/029.phpt Thu Jul 12 20:49:29 2007
@@ -5,11 +5,11 @@
--FILE--
<?php
include "connect.inc";
-
+
/*** test mysqli_connect 127.0.0.1 ***/
- $link = mysqli_connect($host, $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
+ mysqli_select_db($link, $db);
mysqli_query($link, "drop table if exists general_test");
mysqli_query($link, "create table general_test (a int)");
@@ -20,6 +20,8 @@
var_dump($afc);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(3)
+done!
\ No newline at end of file
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php