uw Mon Jul 23 12:11:38 2007 UTC
Added files:
/php-src/ext/mysqli/tests mysqli_class_mysqli_driver_interface.phpt
mysqli_class_mysqli_driver_reflection.phpt
mysqli_class_mysqli_interface.phpt
mysqli_class_mysqli_reflection.phpt
mysqli_class_mysqli_result_interface.phpt
mysqli_class_mysqli_result_reflection.phpt
mysqli_class_mysqli_stmt_interface.phpt
mysqli_class_mysqli_warning.phpt
mysqli_class_mysqli_warning_reflection.phpt
Log:
Adding new tests that check the interface of the classes exported by mysqli
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
--TEST--
Interface of the class mysqli_driver
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
require('connect.inc');
require('table.inc');
$driver = new mysqli_driver();
printf("Parent class:\n");
var_dump(get_parent_class($driver));
printf("\nMethods:\n");
$methods = get_class_methods($driver);
$expected_methods = array();
if (!$IS_MYSQLND) {
/* libmysql only */
$expected_methods = array_merge($expected_methods, array(
'embedded_server_start' => true,
'embedded_server_end' => true,
));
}
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
unset($expected_methods[$method]);
unset($methods[$k]);
}
}
if (!empty($expected_methods)) {
printf("Dumping list of missing methods.\n");
var_dump($expected_methods);
}
if (!empty($methods)) {
printf("Dumping list of unexpected methods.\n");
var_dump($methods);
}
if (empty($expected_methods) && empty($methods))
printf("ok\n");
printf("\nClass variables:\n");
$variables = get_class_vars(get_class($driver));
sort($variables);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nObject variables:\n");
$variables = get_object_vars($driver);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
assert(mysqli_get_client_info() === $driver->client_info);
printf("driver->client_info = '%s'\n", $driver->client_info);
assert(mysqli_get_client_version() === $driver->client_version);
printf("driver->client_version = '%s'\n", $driver->client_version);
assert($driver->driver_version > 0);
printf("driver->driver_version = '%s'\n", $driver->driver_version);
assert(in_array($driver->report_mode,
array(
MYSQLI_REPORT_ALL,
MYSQLI_REPORT_STRICT,
MYSQLI_REPORT_ERROR,
MYSQLI_REPORT_INDEX,
MYSQLI_REPORT_OFF
)
));
printf("driver->report_mode = '%s'\n", $driver->report_mode);
$driver->report_mode = MYSQLI_REPORT_STRICT;
assert($driver->report_mode === MYSQLI_REPORT_STRICT);
assert(is_bool($driver->embedded));
printf("driver->embedded = '%s'\n", $driver->embedded);
printf("driver->reconnect = '%s'\n", $driver->reconnect);
printf("\nAccess to undefined properties:\n");
printf("driver->unknown = '%s'\n", @$driver->unknown);
print "done!";
?>
--EXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
driver->client_info = '%s'
driver->client_version = '%d'
driver->driver_version = '%d'
driver->report_mode = '%d'
driver->embedded = ''
driver->reconnect = ''
Access to undefined properties:
driver->unknown = ''
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
--TEST--
Interface of the class mysqli_driver - Reflection
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (($tmp = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.'))) && ($tmp < 5))
die("skip Reflection not available before PHP 5 (found PHP $tmp)");
/*
Let's not deal with cross-version issues in the EXPECTF/UEXPECTF.
Most of the things which we test are covered by mysqli_class_*_interface.phpt.
Those tests go into the details and are aimed to be a development tool, no more.
*/
if (!$IS_MYSQLND)
die("skip Test has been written for the latest version of mysqlnd
only");
if ($MYSQLND_VERSION < 576)
die("skip Test requires mysqlnd Revision 576 or newer");
?>
--FILE--
<?php
require_once('reflection_tools.inc');
$class = new ReflectionClass('mysqli_driver');
inspectClass($class);
print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli_driver'
isInternal: yes
isUserDefined: no
isInstantiable: yes
isInterface: no
isAbstract: no
isFinal: yes
isIteratable: no
Modifiers: '%d'
Parent Class: ''
Extension: 'mysqli'
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
--TEST--
Interface of the class mysqli
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
require('connect.inc');
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
printf("Parent class:\n");
var_dump(get_parent_class($mysqli));
printf("\nMethods:\n");
$methods = get_class_methods($mysqli);
$expected_methods = array(
'autocommit' => true,
'change_user' => true,
'character_set_name' => true,
'client_encoding' => true,
'close' => true,
'commit' => true,
'connect' => true,
'dump_debug_info' => true,
'escape_string' => true,
'get_charset' => true,
'get_client_info' => true,
'get_server_info' => true,
'get_warnings' => true,
'init' => true,
'kill' => true,
'more_results' => true,
'multi_query' => true,
'mysqli' => true,
'next_result' => true,
'options' => true,
'ping' => true,
'prepare' => true,
'query' => true,
'real_connect' => true,
'real_escape_string' => true,
'real_query' => true,
'rollback' => true,
'select_db' => true,
'set_charset' => true,
'set_local_infile_default' => true,
'set_local_infile_handler' => true,
'set_opt' => true,
'stat' => true,
'stmt_init' => true,
'store_result' => true,
'thread_safe' => true,
'use_result' => true,
);
if ($IS_MYSQLND) {
// mysqlnd only
/* $expected_methods['get_cache_stats'] = true; */
/* $expected_methods['get_client_stats'] = true; */
$expected_methods['get_connection_stats'] = true;
} else {
// libmysql only
if (function_exists('mysqli_disable_reads_from_master'))
$expected_methods['disable_reads_from_master'] = true;
if (function_exists('mysqli_disable_rpl_parse'))
$expected_methods['disable_rpl_parse'] = true;
if (function_exists('mysqli_enable_reads_from_master'))
$expected_methods['enable_reads_from_master'] = true;
if (function_exists('mysqli_enable_rpl_parse'))
$expected_methods['enable_rpl_parse'] = true;
if (function_exists('mysqli_master_query'))
$expected_methods['master_query'] = true;
if (function_exists('mysqli_rpl_parse_enabled'))
$expected_methods['rpl_parse_enabled'] = true;
if (function_exists('mysqli_rpl_probe'))
$expected_methods['rpl_probe'] = true;
if (function_exists('mysqli_rpl_query_type'))
$expected_methods['rpl_query_type'] = true;
if (function_exists('mysqli_slave_query'))
$expected_methods['slave_query'] = true;
if (function_exists('mysqli_ssl_set'))
$expected_methods['ssl_set'] = true;
}
/* we should add ruled when to expect them */
if (function_exists('mysqli_debug'))
$expected_methods['debug'] = true;
if (function_exists('ssl_set'))
$expected_methods['ssl_set'] = true;
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
unset($methods[$k]);
unset($expected_methods[$method]);
}
}
if (!empty($methods)) {
printf("Dumping list of unexpected methods.\n");
var_dump($methods);
}
if (!empty($expected_methods)) {
printf("Dumping list of missing methods.\n");
var_dump($expected_methods);
}
if (empty($methods) && empty($expected_methods))
printf("ok\n");
printf("\nClass variables:\n");
$variables = get_class_vars(get_class($mysqli));
sort($variables);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nObject variables:\n");
$variables = get_object_vars($mysqli);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
$mysqli->affected_rows, gettype($mysqli->affected_rows),
mysqli_affected_rows($link),
gettype(mysqli_affected_rows($link)));
assert(mysqli_get_client_info() === $mysqli->client_info);
printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
$mysqli->client_info, gettype($mysqli->client_info),
mysqli_get_client_info(), gettype(mysqli_get_client_info()));
assert(mysqli_get_client_version() === $mysqli->client_version);
printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
$mysqli->client_version, gettype($mysqli->client_version),
mysqli_get_client_version(),
gettype(mysqli_get_client_version()));
assert(mysqli_errno($link) === $mysqli->errno);
printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
$mysqli->errno, gettype($mysqli->errno),
mysqli_errno($link), gettype(mysqli_errno($link)));
assert(mysqli_error($link) === $mysqli->error);
printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
$mysqli->error, gettype($mysqli->error),
mysqli_error($link), gettype(mysqli_error($link)));
assert(mysqli_field_count($link) === $mysqli->field_count);
printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
$mysqli->field_count, gettype($mysqli->field_count),
mysqli_field_count($link), gettype(mysqli_field_count($link)));
assert(mysqli_insert_id($link) === $mysqli->insert_id);
printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
$mysqli->insert_id, gettype($mysqli->insert_id),
mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
$mysqli->sqlstate, gettype($mysqli->sqlstate),
mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
assert(mysqli_get_host_info($link) === $mysqli->host_info);
printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
$mysqli->host_info, gettype($mysqli->host_info),
mysqli_get_host_info($link),
gettype(mysqli_get_host_info($link)));
/* note that the data types are different */
assert(mysqli_info($link) == $mysqli->info);
printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
$mysqli->info, gettype($mysqli->info),
mysqli_info($link), gettype(mysqli_info($link)));
assert(mysqli_thread_id($link) > $mysqli->thread_id);
assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
$mysqli->thread_id, gettype($mysqli->thread_id),
mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
$mysqli->protocol_version, gettype($mysqli->protocol_version),
mysqli_get_proto_info($link),
gettype(mysqli_get_proto_info($link)));
assert(mysqli_get_server_info($link) === $mysqli->server_info);
printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
$mysqli->server_info, gettype($mysqli->server_info),
mysqli_get_server_info($link),
gettype(mysqli_get_server_info($link)));
assert(mysqli_get_server_version($link) === $mysqli->server_version);
printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
$mysqli->server_version, gettype($mysqli->server_version),
mysqli_get_server_version($link),
gettype(mysqli_get_server_version($link)));
assert(mysqli_warning_count($link) === $mysqli->warning_count);
printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
$mysqli->warning_count, gettype($mysqli->warning_count),
mysqli_warning_count($link),
gettype(mysqli_warning_count($link)));
printf("\nAccess to undefined properties:\n");
printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
@$mysqli->unknown = 13;
printf("setting mysqli->unknown, mysqli_unknown = '%s'\n",
@$mysqli->unknown);
$unknown = 'friday';
@$mysqli->unknown = $unknown;
printf("setting mysqli->unknown, mysqli_unknown = '%s'\n",
@$mysqli->unknown);
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO
documentation):\n");
assert(mysqli_connect_error() === $mysqli->connect_error);
printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
$mysqli->connect_error, gettype($mysqli->connect_error),
mysqli_connect_error(), gettype(mysqli_connect_error()));
assert(mysqli_connect_errno() === $mysqli->connect_errno);
printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
$mysqli->connect_errno, gettype($mysqli->connect_errno),
mysqli_connect_errno(), gettype(mysqli_connect_errno()));
print "done!";
?>
--EXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
mysqli->affected_rows = '%s'/integer ('%s'/integer)
mysqli->client_info = '%s'/string ('%s'/string)
mysqli->client_version = '%d'/integer ('%d'/integer)
mysqli->errno = '0'/integer ('0'/integer)
mysqli->error = ''/string (''/string)
mysqli->field_count = '0'/integer ('0'/integer)
mysqli->insert_id = '0'/integer ('0'/integer)
mysqli->sqlstate = '00000'/string ('00000'/string)
mysqli->host_info = '%s'/string ('%s'/string)
mysqli->info = ''/NULL (''/string)
mysqli->thread_id = '%d'/integer ('%d'/integer)
mysqli->protocol_version = '%d'/integer ('%d'/integer)
mysqli->server_info = '%s'/string ('%s'/string)
mysqli->server_version = '%d'/integer ('%d'/integer)
mysqli->warning_count = '0'/integer ('0'/integer)
Access to undefined properties:
mysqli->unknown = ''
setting mysqli->unknown, mysqli_unknown = '13'
setting mysqli->unknown, mysqli_unknown = 'friday'
Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):
mysqli->connect_error = ''/string (''/string)
mysqli->connect_errno = '0'/integer ('0'/integer)
done!
--UEXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
mysqli->affected_rows = '%s'/integer ('%s'/integer)
mysqli->client_info = '%s'/unicode ('%s'/unicode)
mysqli->client_version = '%d'/integer ('%d'/integer)
mysqli->errno = '0'/integer ('0'/integer)
mysqli->error = ''/unicode (''/unicode)
mysqli->field_count = '0'/integer ('0'/integer)
mysqli->insert_id = '0'/integer ('0'/integer)
mysqli->sqlstate = '00000'/unicode ('00000'/unicode)
mysqli->host_info = '%s'/unicode ('%s'/unicode)
mysqli->info = ''/NULL (''/unicode)
mysqli->thread_id = '%d'/integer ('%d'/integer)
mysqli->protocol_version = '%d'/integer ('%d'/integer)
mysqli->server_info = '%s'/unicode ('%s'/unicode)
mysqli->server_version = '%d'/integer ('%d'/integer)
mysqli->warning_count = '0'/integer ('0'/integer)
Access to undefined properties:
mysqli->unknown = ''
setting mysqli->unknown, mysqli_unknown = '13'
setting mysqli->unknown, mysqli_unknown = 'friday'
Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):
mysqli->connect_error = ''/unicode (''/unicode)
mysqli->connect_errno = '0'/integer ('0'/integer)
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
--TEST--
Interface of the class mysqli - Reflection
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (($tmp = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.'))) && ($tmp < 5))
die("skip Reflection not available before PHP 5 (found PHP $tmp)");
/*
Let's not deal with cross-version issues in the EXPECTF/UEXPECTF.
Most of the things which we test are covered by mysqli_class_*_interface.phpt.
Those tests go into the details and are aimed to be a development tool, no more.
*/
if (!$IS_MYSQLND)
die("skip Test has been written for the latest version of mysqlnd
only");
if ($MYSQLND_VERSION < 576)
die("skip Test requires mysqlnd Revision 576 or newer");
?>
--FILE--
<?php
require_once('reflection_tools.inc');
$class = new ReflectionClass('mysqli');
inspectClass($class);
print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli'
isInternal: yes
isUserDefined: no
isInstantiable: yes
isInterface: no
isAbstract: no
isFinal: no
isIteratable: no
Modifiers: '0'
Parent Class: ''
Extension: 'mysqli'
Inspecting method 'mysqli'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 8448
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'autocommit'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'change_user'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'character_set_name'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'client_encoding'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'close'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'commit'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'connect'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'debug'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'dump_debug_info'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'escape_string'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'get_charset'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'get_client_info'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'get_connection_stats'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'get_server_info'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'get_warnings'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'init'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'kill'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'more_results'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'multi_query'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'mysqli'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 8448
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'next_result'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'options'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'ping'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'prepare'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'query'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'real_connect'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'real_escape_string'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'real_query'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'rollback'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'select_db'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'set_charset'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'set_local_infile_default'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'set_local_infile_handler'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'set_opt'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'stat'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'stmt_init'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'store_result'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'thread_safe'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'use_result'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 0
Number of Required Parameters: 0
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
--TEST--
Interface of the class mysqli_result
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
?>
--FILE--
<?php
require('connect.inc');
require('table.inc');
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$mysqli_result = $mysqli->query('SELECT * FROM test');
$row = $mysqli_result->fetch_row();
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$res = mysqli_query($link, 'SELECT * FROM test');
assert(mysqli_fetch_row($res) === $row);
printf("Parent class:\n");
var_dump(get_parent_class($mysqli_result));
printf("\nMethods:\n");
$methods = get_class_methods($mysqli_result);
$expected_methods = array(
'__construct' => true,
'close' => true,
'data_seek' => true,
'fetch_array' => true,
'fetch_assoc' => true,
'fetch_field' => true,
'fetch_field_direct' => true,
'fetch_fields' => true,
'fetch_object' => true,
'fetch_row' => true,
'field_seek' => true,
'free' => true,
'free_result' => true,
);
if ($IS_MYSQLND)
$expected_methods['fetch_all'] = true;
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
unset($expected_methods[$method]);
unset($methods[$k]);
}
if ($method == 'mysqli_result') {
// get_class_method reports different constructor names
unset($expected_methods['__construct']);
unset($methods[$k]);
}
}
if (!empty($expected_methods)) {
printf("Dumping list of missing methods.\n");
var_dump($expected_methods);
}
if (!empty($methods)) {
printf("Dumping list of unexpected methods.\n");
var_dump($methods);
}
if (empty($expected_methods) && empty($methods))
printf("ok\n");
printf("\nClass variables:\n");
$variables = get_class_vars(get_class($mysqli_result));
sort($variables);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nObject variables:\n");
$variables = get_object_vars($mysqli_result);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
assert(($tmp = mysqli_field_tell($res)) ===
$mysqli_result->current_field);
printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n",
$mysqli_result->current_field,
gettype($mysqli_result->current_field),
$tmp, gettype($tmp));
assert(($tmp = mysqli_field_count($link)) ===
$mysqli_result->field_count);
printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n",
$mysqli_result->field_count,
gettype($mysqli_result->field_count),
$tmp, gettype($tmp));
assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n",
((is_array($mysqli_result->lengths)) ? implode(' ',
$mysqli_result->lengths) : 'n/a'),
gettype($mysqli_result->lengths),
((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'),
gettype($tmp));
assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n",
$mysqli_result->num_rows, gettype($mysqli_result->num_rows),
$tmp, gettype($tmp));
assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT,
MYSQLI_USE_RESULT)));
printf("mysqli_result->type = '%s'/%s\n",
((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' :
'use'),
gettype($mysqli_result->type));
printf("\nAccess to undefined properties:\n");
printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
printf("\nConstructor:\n");
if (!is_object($res = new mysqli_result($link)))
printf("[001] Expecting object/mysqli_result got %s/%s\n",
gettye($res), $res);
if (null !== ($tmp = @$res->num_rows))
printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
if (!mysqli_query($link, "SELECT id FROM test ORDER BY id"))
printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!is_object($res = new mysqli_result($link)))
printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT)))
printf("[005] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
printf("[006] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!is_object($res = new mysqli_result($link, 'invalid')))
printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
do {
$mode = mt_rand(-1000, 1000);
} while (in_array($mode, $valid));
if ($TEST_EXPERIMENTAL) {
ob_start();
if (!is_object($res = new mysqli_result($link, $mode)))
printf("[008] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$content = ob_get_contents();
ob_end_clean();
if (!stristr($content, 'Invalid value for resultmode'))
printf("[009] Expecting warning because of invalid
resultmode\n");
}
if (!is_object($res = new mysqli_result('foo')))
printf("[010] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT,
1)))
printf("[011] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
print "done!";
?>
--EXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
mysqli_result->current_field = '0'/integer ('0'/integer)
mysqli_result->field_count = '2'/integer ('2'/integer)
mysqli_result->lengths -> '1 1'/array ('1 1'/array)
mysqli_result->num_rows = '6'/integer ('6'/integer)
mysqli_result->type = 'store'/integer
Access to undefined properties:
mysqli_result->unknown = ''
Constructor:
Warning: mysqli_result::mysqli_result() expects parameter 2 to be long, string
given in %s on line %d
Warning: mysqli_result::mysqli_result() expects parameter 1 to be mysqli,
string given in %s on line %d
done!
--UEXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
mysqli_result->current_field = '0'/integer ('0'/integer)
mysqli_result->field_count = '2'/integer ('2'/integer)
mysqli_result->lengths -> '1 1'/array ('1 1'/array)
mysqli_result->num_rows = '6'/integer ('6'/integer)
mysqli_result->type = 'store'/integer
Access to undefined properties:
mysqli_result->unknown = ''
Constructor:
Warning: mysqli_result::mysqli_result() expects parameter 2 to be long, Unicode
string given in %s on line %d
Warning: mysqli_result::mysqli_result() expects parameter 1 to be mysqli,
Unicode string given in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
--TEST--
Interface of the class mysqli_result - Reflection
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (($tmp = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.'))) && ($tmp < 5))
die("skip Reflection not available before PHP 5 (found PHP $tmp)");
/*
Let's not deal with cross-version issues in the EXPECTF/UEXPECTF.
Most of the things which we test are covered by mysqli_class_*_interface.phpt.
Those tests go into the details and are aimed to be a development tool, no more.
*/
if (!$IS_MYSQLND)
die("skip Test has been written for the latest version of mysqlnd
only");
if ($MYSQLND_VERSION < 576)
die("skip Test requires mysqlnd Revision 576 or newer");
?>
--FILE--
<?php
require_once('reflection_tools.inc');
$class = new ReflectionClass('mysqli_result');
inspectClass($class);
print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli_result'
isInternal: yes
isUserDefined: no
isInstantiable: yes
isInterface: no
isAbstract: no
isFinal: no
isIteratable: no
Modifiers: '0'
Parent Class: ''
Extension: 'mysqli'
Inspecting method '__construct'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method '__construct'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'close'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'data_seek'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_all'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_array'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_assoc'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_field'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_field_direct'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_fields'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_object'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'fetch_row'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'field_seek'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'free'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'free_result'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
--TEST--
Interface of the class mysqli_stmt
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
require('connect.inc');
require('table.inc');
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$stmt = new mysqli_stmt($link);
printf("Parent class:\n");
var_dump(get_parent_class($stmt));
printf("\nMethods:\n");
$methods = get_class_methods($stmt);
$expected_methods = array(
'__construct' => true,
'attr_get' => true,
'attr_set' => true,
'bind_param' => true,
'bind_result' => true,
'close' => true,
'data_seek' => true,
'execute' => true,
'fetch' => true,
'free_result' => true,
'get_warnings' => true,
'num_rows' => true,
'prepare' => true,
'reset' => true,
'result_metadata' => true,
'send_long_data' => true,
'stmt' => true,
'store_result' => true,
);
if ($IS_MYSQLND)
$expected_methods['get_result'] = true;
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
unset($methods[$k]);
unset($expected_methods[$method]);
}
if ($method == 'mysqli_stmt') {
// get_class_method reports different constructor names
unset($expected_methods['__construct']);
unset($methods[$k]);
}
}
if (!empty($methods)) {
printf("More methods found than indicated. Dumping list of
unexpected methods.\n");
var_dump($methods);
}
if (!empty($expected_methods)) {
printf("Some methods are missing. Dumping list of missing
methods.\n");
var_dump($expected_methods);
}
if (empty($methods) && empty($expected_methods))
printf("ok\n");
printf("\nClass variables:\n");
$variables = get_class_vars(get_class($stmt));
sort($variables);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nObject variables:\n");
$variables = get_object_vars($stmt);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows);
printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows);
if (!$stmt->prepare("INSERT INTO test(id, label) VALUES (100, 'z')") ||
!$stmt->execute())
printf("[001] [%d] %s\n", $stmt->errno, $stmt->error);
assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows);
printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows);
assert(mysqli_stmt_errno($stmt) === $stmt->errno);
printf("stmt->errno = '%s'\n", $stmt->errno);
assert(mysqli_stmt_error($stmt) === $stmt->error);
printf("stmt->error = '%s'\n", $stmt->error);
assert(mysqli_stmt_field_count($stmt) === $stmt->field_count);
printf("stmt->field_count = '%s'\n", $stmt->field_count);
assert($stmt->id > 0);
printf("stmt->id = '%s'\n", $stmt->id);
assert(mysqli_stmt_insert_id($stmt) === $stmt->insert_id);
printf("stmt->insert_id = '%s'\n", $stmt->insert_id);
assert(mysqli_stmt_num_rows($stmt) === $stmt->num_rows);
printf("stmt->num_rows = '%s'\n", $stmt->num_rows);
assert(mysqli_stmt_param_count($stmt) === $stmt->param_count);
printf("stmt->param_count = '%s'\n", $stmt->param_count);
assert(mysqli_stmt_sqlstate($stmt) === $stmt->sqlstate);
printf("stmt->sqlstate = '%s'\n", $stmt->sqlstate);
printf("\nAccess to undefined properties:\n");
printf("stmt->unknown = '%s'\n", @$stmt->unknown);
@$stmt->unknown = 13;
printf("stmt->unknown = '%s'\n", @$stmt->unknown);
printf("\nPrepare using the constructor:\n");
$stmt = new mysqli_stmt($link, 'SELECT id FROM test ORDER BY id');
if (!$stmt->execute())
printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
$stmt->close();
$obj = new stdClass();
if (!is_object($stmt = new mysqli_stmt($link, $obj)))
printf("[003] Expecting NULL got %s/%s\n", gettype($stmt), $stmt);
print "done!";
?>
--EXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
Warning: mysqli_stmt_affected_rows(): invalid object or resource mysqli_stmt
in %s on line %d
Warning: main(): Property access is not allowed yet in %s on line %d
Warning: main(): Property access is not allowed yet in %s on line %d
stmt->affected_rows = ''
stmt->affected_rows = '1'
stmt->errno = '0'
stmt->error = ''
stmt->field_count = '0'
stmt->id = '%d'
stmt->insert_id = '0'
stmt->num_rows = '0'
stmt->param_count = '0'
stmt->sqlstate = '00000'
Access to undefined properties:
stmt->unknown = ''
stmt->unknown = '13'
Prepare using the constructor:
Warning: mysqli_stmt::mysqli_stmt() expects parameter 2 to be string, object
given in %s on line %d
done!
--UEXPECTF--
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
Warning: mysqli_stmt_affected_rows(): invalid object or resource mysqli_stmt
in %s on line %d
Warning: main(): Property access is not allowed yet in %s on line %d
Warning: main(): Property access is not allowed yet in %s on line %d
stmt->affected_rows = ''
stmt->affected_rows = '1'
stmt->errno = '0'
stmt->error = ''
stmt->field_count = '0'
stmt->id = '%d'
stmt->insert_id = '0'
stmt->num_rows = '0'
stmt->param_count = '0'
stmt->sqlstate = '00000'
Access to undefined properties:
stmt->unknown = ''
stmt->unknown = '13'
Prepare using the constructor:
Warning: mysqli_stmt::mysqli_stmt() expects parameter 2 to be binary string,
object given in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
--TEST--
Interface of the class mysqli_warning - TODO
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (!$TEST_EXPERIMENTAL)
die("skip - experimental (= unsupported) feature");
?>
--FILE--
<?php
require('connect.inc');
$warning = new mysqli_warning();
$warning = new mysqli_warning(null);
$warning = new mysqli_warning(null, null);
$mysqli = new mysqli();
$warning = new mysqli_warning($mysqli);
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$stmt = new mysqli_stmt($mysqli);
$warning = new mysqli_warning($stmt);
$stmt = $mysqli->stmt_init();
$warning = new mysqli_warning($stmt);
$obj = new stdClass();
$warning = new mysqli_warning($obj);
include("table.inc");
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")');
$warning = mysqli_get_warnings($mysqli);
printf("Parent class:\n");
var_dump(get_parent_class($warning));
printf("\nMethods:\n");
$methods = get_class_methods($warning);
$expected_methods = array(
'next' => true,
);
foreach ($methods as $k => $method) {
if (isset($expected_methods[$method])) {
unset($methods[$k]);
unset($expected_methods[$method]);
}
}
if (!empty($methods)) {
printf("Dumping list of unexpected methods.\n");
var_dump($methods);
}
if (!empty($expected_methods)) {
printf("Dumping list of missing methods.\n");
var_dump($expected_methods);
}
if (empty($methods) && empty($expected_methods))
printf("ok\n");
printf("\nClass variables:\n");
$variables = get_class_vars(get_class($mysqli));
sort($variables);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nObject variables:\n");
$variables = get_object_vars($mysqli);
foreach ($variables as $k => $var)
printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
assert('' === $warning->message);
printf("warning->message = '%s'\n", $warning->message);
assert('' === $warning->sqlstate);
printf("warning->sqlstate= '%s'\n", $warning->sqlstate);
assert(0 === $warning->errno);
printf("warning->errno = '%s'\n", $warning->errno);
printf("\nAccess to undefined properties:\n");
printf("warning->unknown = '%s'\n", @$warning->unknown);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysqli_warning::mysqli_warning() in %s on
line %d
Warning: mysqli_warning::mysqli_warning() expects parameter 1 to be object,
null given in %s on line %d
Warning: Wrong parameter count for mysqli_warning::mysqli_warning() in %s on
line %d
Warning: mysqli_warning::mysqli_warning(): Couldn't fetch mysqli in %s on line
%d
Warning: mysqli_warning::mysqli_warning(): invalid object or resource
mysqli_stmt
in %s on line %d
Warning: mysqli_warning::mysqli_warning(): invalid object or resource
mysqli_stmt
in %s on line %d
Warning: mysqli_warning::mysqli_warning(): invalid class argument in
/home/nixnutz/php6_mysqlnd/ext/mysqli/tests/mysqli_class_mysqli_warning.php on
line 19
Warning: mysqli_warning::mysqli_warning(): No warnings found in %s on line %d
Parent class:
bool(false)
Methods:
ok
Class variables:
Object variables:
Magic, magic properties:
warning->message = ''
warning->sqlstate= ''
warning->errno = ''
Access to undefined properties:
warning->unknown = ''
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
--TEST--
Interface of the class mysqli_stmt - Reflection
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
if (($tmp = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.'))) && ($tmp < 5))
die("skip Reflection not available before PHP 5 (found PHP $tmp)");
/*
Let's not deal with cross-version issues in the EXPECTF/UEXPECTF.
Most of the things which we test are covered by mysqli_class_*_interface.phpt.
Those tests go into the details and are aimed to be a development tool, no more.
*/
if (!$IS_MYSQLND)
die("skip Test has been written for the latest version of mysqlnd
only");
if ($MYSQLND_VERSION < 576)
die("skip Test requires mysqlnd Revision 576 or newer");
?>
--FILE--
<?php
require_once('reflection_tools.inc');
$class = new ReflectionClass('mysqli_warning');
inspectClass($class);
print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli_warning'
isInternal: yes
isUserDefined: no
isInstantiable: no
isInterface: no
isAbstract: no
isFinal: yes
isIteratable: no
Modifiers: '%d'
Parent Class: ''
Extension: 'mysqli'
Inspecting method '__construct'
isFinal: no
isAbstract: no
isPublic: no
isPrivate: no
isProtected: yes
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method '__construct'
isFinal: no
isAbstract: no
isPublic: no
isPrivate: no
isProtected: yes
isStatic: no
isConstructor: yes
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
Inspecting method 'next'
isFinal: no
isAbstract: no
isPublic: yes
isPrivate: no
isProtected: no
isStatic: no
isConstructor: no
isDestructor: no
isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: %d
Number of Parameters: 0
Number of Required Parameters: 0
done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php