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 if (!$IS_MYSQLND && (isset($methods['embedded_server_start']))) { 24 /* libmysql only - needs extra compile flag, no way to check properly in the 25 PHP user land if its compiled in or not */ 26 $expected_methods = array_merge($expected_methods, array( 27 'embedded_server_start' => true, 28 'embedded_server_end' => true, 29 )); 30 } 31 32 foreach ($methods as $k => $method) { 33 if (isset($expected_methods[$method])) { 34 unset($expected_methods[$method]); 35 unset($methods[$k]); 36 } 37 } 38 if (!empty($expected_methods)) { 39 printf("Dumping list of missing methods.\n"); 40 var_dump($expected_methods); 41 } 42 if (!empty($methods)) { 43 printf("Dumping list of unexpected methods.\n"); 44 var_dump($methods); 45 } 46 if (empty($expected_methods) && empty($methods)) 47 printf("ok\n"); 48 49 printf("\nClass variables:\n"); 50 $variables = array_keys(get_class_vars(get_class($driver))); 51 sort($variables); 52 foreach ($variables as $k => $var) 53 printf("%s\n", $var); 54 55 printf("\nObject variables:\n"); 56 $variables = array_keys(get_object_vars($driver)); 57 foreach ($variables as $k => $var) 58 printf("%s\n", $var); 59 60 printf("\nMagic, magic properties:\n"); 61 62 assert(mysqli_get_client_info() === $driver->client_info); 63 printf("driver->client_info = '%s'\n", $driver->client_info); 64 65 assert(mysqli_get_client_version() === $driver->client_version); 66 printf("driver->client_version = '%s'\n", $driver->client_version); 67 68 assert($driver->driver_version > 0); 69 printf("driver->driver_version = '%s'\n", $driver->driver_version); 70 71 assert(in_array($driver->report_mode, 72 array( 73 MYSQLI_REPORT_ALL, 74 MYSQLI_REPORT_STRICT, 75 MYSQLI_REPORT_ERROR, 76 MYSQLI_REPORT_INDEX, 77 MYSQLI_REPORT_OFF 78 ) 79 )); 80 81 printf("driver->report_mode = '%s'\n", $driver->report_mode); 82 $driver->report_mode = MYSQLI_REPORT_STRICT; 83 assert($driver->report_mode === MYSQLI_REPORT_STRICT); 84 85 assert(is_bool($driver->embedded)); 86 printf("driver->embedded = '%s'\n", $driver->embedded); 87 88 printf("driver->reconnect = '%s'\n", $driver->reconnect); 89 90 printf("\nAccess to undefined properties:\n"); 91 printf("driver->unknown = '%s'\n", @$driver->unknown); 92 93 print "done!"; 94?> 95--EXPECTF-- 96Parent class: 97bool(false) 98 99Methods: 100ok 101 102Class variables: 103client_info 104client_version 105driver_version 106embedded 107reconnect 108report_mode 109 110Object variables: 111client_info 112client_version 113driver_version 114embedded 115reconnect 116report_mode 117 118Magic, magic properties: 119driver->client_info = '%s' 120driver->client_version = '%d' 121driver->driver_version = '%d' 122driver->report_mode = '%d' 123driver->embedded = '' 124driver->reconnect = '' 125 126Access to undefined properties: 127driver->unknown = '' 128done! 129