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