xref: /php-src/ext/mysqli/tests/mysqli_stat.phpt (revision 7e5171d1)
1--TEST--
2mysqli_stat()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13        printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14            $host, $user, $db, $port, $socket);
15        exit(1);
16    }
17
18    if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
19        printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
20            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
21
22    mysqli_close($link);
23
24    try {
25        mysqli_stat($link);
26    } catch (Error $exception) {
27        echo $exception->getMessage() . "\n";
28    }
29
30    print "done!";
31?>
32--EXPECT--
33mysqli object is already closed
34done!
35