Author: uwendel
Date: 2007-03-14 11:11:44 +0100 (Wed, 14 Mar 2007)
New Revision: 128
Added:
trunk/ext/mysqli/tests/mysqli_get_warnings.phpt
Log:
Test fails, without documentation it's a guessing game how the test should look like. Test
needs to be reviewed.
Added: trunk/ext/mysqli/tests/mysqli_get_warnings.phpt
===================================================================
--- trunk/ext/mysqli/tests/mysqli_get_warnings.phpt 2007-03-14 10:06:52 UTC (rev 127)
+++ trunk/ext/mysqli/tests/mysqli_get_warnings.phpt 2007-03-14 10:11:44 UTC (rev 128)
@@ -0,0 +1,75 @@
+--TEST--
+mysqli_get_warnings()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php require_once('skipifemb.inc'); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_get_warnings()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_get_warnings($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (false !== ($tmp = mysqli_get_warnings($link))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
+ printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
+
+ if (!method_exists($warning, 'next'))
+ printf("[009] Borked object, method next is missing\n");
+
+ $properties = array_merge(get_object_vars($warning),
get_class_vars(get_class($warning)));
+ if (!empty($properties))
+ printf("[010] Properties have always been magic, hidden things - why are they
visible now, a BC break...\n");
+
+ if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or
not there at all */
+ printf("[011] Expecting string/not empty, got %s/%s\n",
gettype($warning->message), $warning->message);
+
+ if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or
not there at all */
+ printf("[012] Expecting string/not empty, got %s/%s\n",
gettype($warning->sqlstate), $warning->sqlstate);
+
+ if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there
at all */
+ printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno),
$warning->errno);
+
+ if (!is_null($tmp = $warning->next()))
+ printf("[014] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000000)"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' !=
get_class($warning)) {
+ printf("[016] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
+
+ if (!is_object($tmp = $warning->next()))
+ printf("[014] Expecting object:mysqli_warning/any, got %s/%s\n", gettype($tmp),
$tmp);
+
+
+ mysqli_close($link);
+
+ print "done!";
+?>
+--EXPECTF--
+done!
\ No newline at end of file
| Thread |
|---|
| • PHP mysqlnd svn commit: r128 - trunk/ext/mysqli/tests | uwendel | 14 Mar |