1--TEST--
2Interface of the class mysqli_driver
3--EXTENSIONS--
4mysqli
5--FILE--
6<?php
7
8$driver = new mysqli_driver();
9
10printf("Parent class:\n");
11var_dump(get_parent_class($driver));
12
13printf("\nMethods:\n");
14$methods = get_class_methods($driver);
15$expected_methods = [];
16
17foreach ($methods as $k => $method) {
18    if (isset($expected_methods[$method])) {
19        unset($expected_methods[$method], $methods[$k]);
20    }
21}
22if (!empty($expected_methods)) {
23    printf("Dumping list of missing methods.\n");
24    var_dump($expected_methods);
25}
26if (!empty($methods)) {
27    printf("Dumping list of unexpected methods.\n");
28    var_dump($methods);
29}
30if (empty($expected_methods) && empty($methods)) {
31    printf("ok\n");
32}
33
34printf("\nClass variables:\n");
35$variables = array_keys(get_class_vars(get_class($driver)));
36sort($variables);
37foreach ($variables as $var) {
38    printf("%s\n", $var);
39}
40
41printf("\nObject variables:\n");
42$variables = array_keys(get_object_vars($driver));
43foreach ($variables as $var) {
44    printf("%s\n", $var);
45}
46
47printf("\nMagic, magic properties:\n");
48
49assert(mysqli_get_client_info() === $driver->client_info);
50printf("driver->client_info = '%s'\n", $driver->client_info);
51
52assert(mysqli_get_client_version() === $driver->client_version);
53printf("driver->client_version = '%s'\n", $driver->client_version);
54
55printf("driver->driver_version = '%s'\n", $driver->driver_version);
56
57assert(in_array($driver->report_mode, [
58    MYSQLI_REPORT_ALL,
59    MYSQLI_REPORT_STRICT,
60    MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR,
61    MYSQLI_REPORT_STRICT|MYSQLI_REPORT_INDEX,
62    MYSQLI_REPORT_ERROR,
63    MYSQLI_REPORT_ERROR|MYSQLI_REPORT_INDEX,
64    MYSQLI_REPORT_INDEX,
65    MYSQLI_REPORT_OFF
66]));
67
68printf("driver->report_mode = '%s'\n", $driver->report_mode);
69$driver->report_mode = MYSQLI_REPORT_STRICT;
70assert($driver->report_mode === MYSQLI_REPORT_STRICT);
71
72printf("driver->reconnect = '%s'\n", $driver->reconnect);
73
74printf("\nAccess to undefined properties:\n");
75printf("driver->unknown = '%s'\n", @$driver->unknown);
76
77print "done!";
78?>
79--EXPECTF--
80Parent class:
81bool(false)
82
83Methods:
84ok
85
86Class variables:
87client_info
88client_version
89driver_version
90reconnect
91report_mode
92
93Object variables:
94reconnect
95report_mode
96
97Magic, magic properties:
98driver->client_info = '%s'
99driver->client_version = '%d'
100
101Deprecated: The driver_version property is deprecated in %s on line %d
102driver->driver_version = '%d'
103driver->report_mode = '%d'
104driver->reconnect = ''
105
106Access to undefined properties:
107driver->unknown = ''
108done!
109