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("\nAccess to undefined properties:\n");
73printf("driver->unknown = '%s'\n", @$driver->unknown);
74
75print "done!";
76?>
77--EXPECTF--
78Parent class:
79bool(false)
80
81Methods:
82ok
83
84Class variables:
85client_info
86client_version
87driver_version
88report_mode
89
90Object variables:
91report_mode
92
93Magic, magic properties:
94driver->client_info = '%s'
95driver->client_version = '%d'
96
97Deprecated: The driver_version property is deprecated in %s on line %d
98driver->driver_version = '%d'
99driver->report_mode = '%d'
100
101Access to undefined properties:
102driver->unknown = ''
103done!
104