diff options
| author | Dharman <tekiela246@gmail.com> | 2021-03-13 18:17:56 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-15 10:34:55 +0100 |
| commit | 4bd3cb66263ef9430c1def80ef836226f83f6317 (patch) | |
| tree | e6910027165d93cf01e7b745bbd1da28ae822015 /ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt | |
| parent | 5801ead8ea03b78a9f320e0ac1cdff171a49dc0b (diff) | |
| download | php-git-4bd3cb66263ef9430c1def80ef836226f83f6317.tar.gz | |
Clean up mysqli_driver test cases
And remove an unnecessary test case that is already covered by the
other two.
Diffstat (limited to 'ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt')
| -rw-r--r-- | ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt index 55fd3be47e..32d13d6750 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt @@ -3,81 +3,81 @@ Interface of the class mysqli_driver --SKIPIF-- <?php require_once('skipif.inc'); -require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require('connect.inc'); - require('table.inc'); - $driver = new mysqli_driver(); +$driver = new mysqli_driver(); - printf("Parent class:\n"); - var_dump(get_parent_class($driver)); +printf("Parent class:\n"); +var_dump(get_parent_class($driver)); - printf("\nMethods:\n"); - $methods = get_class_methods($driver); - $expected_methods = array(); +printf("\nMethods:\n"); +$methods = get_class_methods($driver); +$expected_methods = []; - foreach ($methods as $k => $method) { - if (isset($expected_methods[$method])) { - unset($expected_methods[$method]); - unset($methods[$k]); - } +foreach ($methods as $k => $method) { + if (isset($expected_methods[$method])) { + unset($expected_methods[$method], $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 = array_keys(get_class_vars(get_class($driver))); - sort($variables); - foreach ($variables as $k => $var) - printf("%s\n", $var); - - printf("\nObject variables:\n"); - $variables = array_keys(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); - - printf("driver->reconnect = '%s'\n", $driver->reconnect); - - printf("\nAccess to undefined properties:\n"); - printf("driver->unknown = '%s'\n", @$driver->unknown); - - print "done!"; +} +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 = array_keys(get_class_vars(get_class($driver))); +sort($variables); +foreach ($variables as $var) { + printf("%s\n", $var); +} + +printf("\nObject variables:\n"); +$variables = array_keys(get_object_vars($driver)); +foreach ($variables as $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, [ + MYSQLI_REPORT_ALL, + MYSQLI_REPORT_STRICT, + MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR, + MYSQLI_REPORT_STRICT|MYSQLI_REPORT_INDEX, + MYSQLI_REPORT_ERROR, + MYSQLI_REPORT_ERROR|MYSQLI_REPORT_INDEX, + 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); + +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: |
