[PHP-CVS] cvs: php-src /ext/mysqli/tests mysqli_class_mysqli_driver_interface.phpt

2009-05-29 Thread Ulf Wendel
uw  Fri May 29 10:25:37 2009 UTC

  Modified files:  
/php-src/ext/mysqli/tests   mysqli_class_mysqli_driver_interface.phpt 
  Log:
  Weaker test: functions are only available if HAVE_EMBEDDED_MYSQLI is set. 
There is probably no proper way to check this condition in the user land.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
diff -u php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt:1.3 
php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt:1.4
--- php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt:1.3  
Tue Mar 18 16:58:43 2008
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt  Fri May 
29 10:25:37 2009
@@ -1,7 +1,7 @@
 --TEST--
 Interface of the class mysqli_driver
 --SKIPIF--
-?php 
+?php
 require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
@@ -20,11 +20,12 @@
$methods = get_class_methods($driver);
$expected_methods = array();
 
-   if (!$IS_MYSQLND) {
-   /* libmysql only */
+   if (!$IS_MYSQLND  (isset($methods['embedded_server_start']))) {
+   /* libmysql only - needs extra compile flag, no way to check 
properly in the
+   PHP user land if its compiled in or not */
$expected_methods = array_merge($expected_methods, array(
-   'embedded_server_start' = true,
-   'embedded_server_end'   = true,
+   'embedded_server_start' = true,
+   'embedded_server_end'   = true,
));
}
 



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



[PHP-CVS] cvs: 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 mys

2007-07-23 Thread Ulf Wendel
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=markuprev=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=markuprev=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))