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