uw              Wed Oct 10 10:20:11 2007 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/mysqli/tests   mysqli_thread_id.phpt 
                                mysqli_thread_safe.phpt 
                                mysqli_unclonable.phpt 
                                mysqli_use_result.phpt 
                                mysqli_warning_count.phpt 
                                mysqli_warning_unclonable.phpt 
  Log:
  Last bunch of new tests.
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_thread_id.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_thread_id.phpt
+++ php-src/ext/mysqli/tests/mysqli_thread_id.phpt
--TEST--
mysqli_thread_id()
--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_thread_id()))
                printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        if (!is_null($tmp = @mysqli_thread_id($link)))
                printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        require('table.inc');

        if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
                printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
                        gettype($tmp), $tmp, mysqli_errno($link), 
mysqli_error($link));

        // should work if the thread id is correct
        mysqli_kill($link, mysqli_thread_id($link));

        mysqli_close($link);

        if (NULL !== ($tmp = mysqli_thread_id($link)))
                printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        print "done!";
?>
--EXPECTF--
Warning: mysqli_thread_id(): Couldn't fetch mysqli in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_thread_safe.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_thread_safe.phpt
+++ php-src/ext/mysqli/tests/mysqli_thread_safe.phpt
--TEST--
mysqli_thread_safe()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
        if (!is_bool($tmp = mysqli_thread_safe()))
                printf("[001] Expecting boolean/any, got %s/%s.\n", 
gettype($tmp), $tmp);

        print "done!";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_unclonable.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_unclonable.phpt
+++ php-src/ext/mysqli/tests/mysqli_unclonable.phpt
--TEST--
Trying to clone mysqli object
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
        include "connect.inc";

        if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
                printf("[001] Cannot connect to the server using host=%s, 
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
                        $host, $user, $db, $port, $socket);

        $link_clone = clone $link;
        mysqli_close($link);

        print "done!";
?>
--EXPECTF--
Fatal error: Trying to clone an uncloneable object of class mysqli in %s on 
line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_use_result.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_use_result.phpt
+++ php-src/ext/mysqli/tests/mysqli_use_result.phpt
--TEST--
mysqli_use_result()
--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_use_result()))
                printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        if (!is_null($tmp = @mysqli_use_result($link)))
                printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        require('table.inc');

        if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER 
BY id"))
                printf("[003] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (!is_object($res = mysqli_use_result($link)))
                printf("[004] Expecting object, got %s/%s. [%d] %s\n",
                        gettype($res), $res, mysqli_errno($link), 
mysqli_error($link));

        if (false !== ($tmp = mysqli_data_seek($res, 2)))
                printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
                        gettype($tmp), $tmp, mysqli_errno($link), 
mysqli_error($link));

        mysqli_free_result($res);

        if (!mysqli_query($link, "DELETE FROM test"))
                printf("[006] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (false !== ($res = mysqli_use_result($link)))
                printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
                        gettype($res), $res, mysqli_errno($link), 
mysqli_error($link));

        if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY 
id"))
                printf("[008] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (false !== ($tmp = mysqli_data_seek($res, 1)))
                printf("[009] Expecting boolean/false, got %s/%s\n",
                        gettype($tmp), $tmp);

        mysqli_close($link);

        if (NULL !== ($tmp = mysqli_use_result($link)))
                printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        print "done!";
?>
--EXPECTF--
Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in 
%s on line %d

Warning: mysqli_use_result(): Couldn't fetch mysqli in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_warning_count.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_warning_count.phpt
+++ php-src/ext/mysqli/tests/mysqli_warning_count.phpt
--TEST--
mysqli_warning_count()
--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_warning_count()))
                printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        if (!is_null($tmp = @mysqli_warning_count($link)))
                printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        require('table.inc');

        if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many")))
                printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
                printf("[004] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (0 !== ($tmp = mysqli_warning_count($link)))
                printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), 
$tmp);

        if (!mysqli_query($link, "DROP TABLE IF EXISTS 
this_table_does_not_exist"))
                printf("[006] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (1 !== ($tmp = mysqli_warning_count($link)))
                printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), 
$tmp);

        mysqli_close($link);

        if (NULL !== ($tmp = mysqli_warning_count($link)))
                printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        print "done!";
?>
--EXPECTF--
Warning: mysqli_warning_count(): Couldn't fetch mysqli in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_warning_unclonable.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_warning_unclonable.phpt
+++ php-src/ext/mysqli/tests/mysqli_warning_unclonable.phpt
--TEST--
Trying to clone mysqli_warning object
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (!$TEST_EXPERIMENTAL)
        die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
        include "connect.inc";

        if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
                printf("[001] Cannot connect to the server using host=%s, 
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
                        $host, $user, $db, $port, $socket);

        if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
                printf("[002] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
                printf("[003] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
                printf("[004] [%d] %s\n", mysqli_errno($link), 
mysqli_error($link));

        if (!is_object($warning = mysqli_get_warnings($link)) || 
'mysqli_warning' != get_class($warning)) {
                printf("[005] Expecting object/mysqli_warning, got %s/%s\n", 
gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
        }

        $warning_clone = clone $warning;
        print "done!";
?>
--EXPECTF--
Fatal error: Trying to clone an uncloneable object of class mysqli_warning in 
%s on line %d

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to